Browse Author: trupti.karale

Get CrashLogs with Fabric Crashlytics

Crashlytics provides deep and actionable insights, even the exact line of code your app crashed on. While Crashlytics gives you powerful crash reporting, with one additional click you can enable real-time analytics that help you understand what’s happening in your app.

Installation:

1. Add kit to your Podfile.

use_frameworks!
pod ‘Fabric’
pod ‘Crashlytics’

Then run following command in your terminal

pod install

2. In Project Navigator select your project from targets -> go to Build Phase -> click on plus button and add “New Run Script Phase” and paste following code

“${PODS_ROOT}/Fabric/run” ba500759ec59e71c692c2e3e003edd73e25207c2 13fd4768392c1fb440b9bb7447dab03757c569a498a25c7e667fdbdefd52f57b

3. Add API in Info.plist file

<key>Fabric</key>
<dict>
<key>APIKey</key>
<string>ba500759ec59e71c692c2e3e003edd73e25207c2</string>
<key>Kits</key>
<array>
<dict>
<key>KitInfo</key>
<dict/>
<key>KitName</key>
<string>Crashlytics</string>
</dict>
</array>
</dict>

 

Initialize Your Kit

In AppDelegate. swift file

import Fabric
import Crashlytics

Then in application DidFinishLaunch method

Fabric.with([Crashlytics.self])

 

To get User Information

  • Add following method in your appDelegate file and call this method after  Fabric.with([Crashlytics.self]) this
  • line of code.
  • func logUser() {
    // TODO: Use the current user’s information
    // You can call any combination of these three methods
    Crashlytics.sharedInstance().setUserEmail(“user@fabric.io”)
    Crashlytics.sharedInstance().setUserIdentifier(“12345”)
    Crashlytics.sharedInstance().setUserName(“Test User”)
    }

 

 

 

Zbar SDK is not working well in iOS6

To solved the problem follow the steps:

  1. Go to the ZBar homepage and navigate to the mercurial repository (direct link)
  2. Download the zbar repository as zip.
  3. Unzip the file and navigate to the subfolder named “iphone”.
  4. Open the XCode project.
  5. Delete the “Examples” folder (the folder caused a build error on my machine).
  6. Hit “CMD + B” and build the source.
  7. Find your new libzbar.a file. (User/Library/Developer/Xcode/DerivedData/zbar…)
  8. Replace the old libzbar.a file in your project with the new one.
  9. Hit “CMD + R” and you are good to go.

 

How to access passes from passbook in app?

Create AppId which is similar to passTypeIdentifier. For example if your passTypeIdentifier is pass.abc.xyz then your AppId must be com.abc.xyz .While creating provisioning profile make use of this appId and make use of this provisioning profile for your app. Then only you will be able to distinguish passes available in your passbook.

Also, Keep in mind that the App ID you signing your code with should be Enable for Passes on the Provisioning portal as well.