
Fabric Crashlytics is a crash reporting tool that helps us track crashes in our app. But while you are working on a project with different environments, say (debug and release) how would you track the crashes based on a particular environment. One way to track this is by differentiating between the build numbers. But what if we have the same version and build numbers for both debug and release builds.
You can achieve this by creating a separate app under separate organisation for debugging and release builds in Fabric. You can create two organisations, one for development and one for release. Then, add your app in both the organization. Now when you get crash for a release build, you would receive the crash in the app under the release organisation. But here comes the problem, there would be separate API key and Secret Key for both the organisations. You have to configure the keys based on the environment in Xcode. Xcode’s custom user-defined setting can be used to solve this problem.
- Go to your project’s build settings. Choose the “+” button to add a user-defined setting as shown below.
- Add your fabric API key and secret key based on your environment as shown in the image.
- Go to your build phases tab, and add the run script as follows. Project/SubModules/Fabric/Fabric.framework/run ${FABRIC_API_KEY} ${FABRIC_SECRET_KEY}
- Go to your info.plist file and add the value of API key as “${FABRIC_API_KEY}” so that it takes the value dynamically based on the environment we are running.
Conclusion:
Now when you run the app, the crash would be logged separately based on the environment we are running.
Rajtharan G,
iOS App Development Team,
Mallow Technologies.