Stop tracking Crashlytics runtime in iOS - ios

I've just integrated Crashlytics with iOS and it's quite easy integration steps. I started session of crashlytics in didFinishLaunchingWithOptions with code [Fabric with:#[[Crashlytics class]]]; and its start tracking.
At some point in App I want to stop tracking of Crashlytics so how Can I do this? Is there any code for this? There is a way to stop tracking from online Dashboard in Crashlytics but I want to do from Code.
Looking for suggestions and help.
Thanks.

Xcode debugger does NOT allow Crashlytics to process crash reports.
if you have your device connected to your Mac, XCode's debugger will step in as well. So just disconnect the device before testing.
To make sure a crash is reported during your simulator testing:
Launch simulator
Press stop
Launch your app and force a crash
Relaunch the app from simulator
See the crash report in the web dashboard
Reference

Mike from Fabric here. I believe you're looking to kill an active Fabric session once it's been started with the same launch/session of the app.
In that case, there is not a way to kill the SDK session. I'd recommend wrapping the Fabric init in a conditional call or boolean check to see if Fabric should be initialized or not.

Related

IOS app stuck in splash screen on IOS version 10.2.1 with no error

My iOS app was perfectly working till yesterday. My QA was testing and there was no bug at all. But when I tried to install from Xcode to my iPhone 6 somehow it got stuck in splash screen and debugger shows absolutely no error. I googled a lot but no luck. I even tried to run previous version by switching my current branch but no luck.
This is what my debugger look like:
2018-02-07 12:49:56.982145 Marham[547:85300] 4.8.1 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40009000 started
2018-02-07 12:49:56.982649 Marham[547:85300] 4.8.1 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see [some-Link])
2018-02-07 12:49:56.983029 Marham[547:85300] 4.8.1 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
[some-Link]to ensure proper integration.
(lldb)
and here is the surprising thing for me that, app runs without any issue on simulator but got stuck only on real device.
Do you still have this issue ?
Because I had a similar one and that was because a local storage variable was blocking the execution of the first view on the phone (the simulator was working fine).
So I advise you to put your phone on debut mode and make a breakpoint on the main function in the App Delegate.
This way, you should be able to se if there's an async function waiting for nothing.

"[Crashlytics:Crash] Reporting is disabled"

I am getting the following error messages when our production iOS app initializes:
[Crashlytics] Version 3.8.4 (121)
[Crashlytics] Running on iOS Simulator (iPhone), 10.3.0 (16E195)
[Crashlytics:Crash] Reporting is disabled
[Crashlytics] Crash reporting could not be initialized
[Answers] Initialized
[Fabric] Initialized with kit versions: {
"com.twitter.answers.ios" = "1.3.4";
"com.twitter.crashlytics.ios" = "3.8.4";
"io.fabric.sdk.ios" = "1.6.11";
}
Every subsequent call to log an event gets the following error:
[Crashlytics:Crash] WARNING: CLSLog has been used before (or concurrently with)
Crashlytics initialization and cannot be recorded. The message was: ...
The non-production versions of the app work fine running the exact same code but with different bundleIDs. Normally when the app initializes for the first time, then I see the app populate in the Fabric dashboard, but in this case the app is not showing up.
We have an Android and an iOS version of the app, and they both use the same bundleID, so I am wondering if there is a conflict because of that? I see the Android version of the app in the dashboard, and it seems to be working properly. This is an app that originally was a Xamarin app that compiled to both platforms, neither of which incorporated Fabric/Crashlytics. We have now written native apps on each platform, and both are using Fabric/Crashlytics.
Since this is a pre-existing app in both stores, we do not have the option of changing either app’s bundleID.
Make sure you initialize Crashlytics with Fabric before calling any Crashlytics methods:
Fabric.with([Crashlytics.self])
One step I routinely miss is to make sure you've added the build phase on your target:
"${PODS_ROOT}/Fabric/run" ${FABRIC_API_KEY} ${FABRIC_BUILD_SECRET}
and either replace ${FABRIC_API_KEY} and ${FABRIC_BUILD_SECRET} with your key and secret or add custom build settings for each.
There are apparently cases where Crashlytics does not auto-activate new apps so that they show up under your list of apps, even though everything is coded correctly and data is going to their servers. In this case, send an email to Crashlytics support (support#fabric.io) that contains a copy of the info.plist entries for the app in question and they will activate it for you. I have had to do this several times, especially with app extensions.
When I finally traced it down in my situation, the error was entirely correct, but not obvious.
I saw these errors in various testing targets where the code we tested was using a custom logging wrapper which called CLSNSLogv(), but the test didn't actually go through the AppDelegate and therefore did NOT initialize Crashlytics. After trying a few things I was convinced that it worked when executed as an app, but in our configuration it was not working under the unit test configuration.
I'll likely alter our custom wrapper to bypass CLSNSLogv() during testing anyway. The biggest benefit of using that is when crashes occur on devices, so we won't be missing anything.

HockeySDK Warning - How to test crash reporting?

I got this warning when running my application with HockeyApp integration:
[HockeySDK] WARNING: Detecting crashes is NOT enabled due to running the app with a debugger attached.
Crash reports are not sent and no alert is displayed when opening the app again.
Any one have any idea how to resolve this issue?
This has very simple reasons:
If you are running the app with Xcode attached, your app is connected to lldb, Xcode's debugger. When lldb is attached, it will of course do its job as a debugger and catch any exception or crash that occurs. This means that the crash can never reach the HockeyApp SDK or any other crash reporting SDK while lldb is attached at the same time.
The solution is also pretty simple. If you just want to make sure the SDK is integrated properly and will catch crashes, do the following:
Do a quick "Build & Run" to install the current version of the app on the simulator or device.
Click the "Stop" button in Xcode to stop the debugging session.
Manually start the app on the device or simulator by tapping or clicking the app icon.
Cause a crash.
Restart the app. Now the HockeySDK should process the crash report and show a dialog to approve crash log sending.
One thing to keep in mind: Make sure to not make the app crash immediately after app start as this would not give the SDK enough time to process and send the crash report before crashing again.
Hockey app sdk by default does not send report when a debugger is attached. There is nothing wrong with this.
It will send report when a archive build that release to ur tester cause a crash. I personally think this should and remain as this because you are trying to track crashes from your tester not when you are developing.

Xcode+watchkit simulation: does not support a debuggable architecture:

I am trying to run in Xcode both the main App (which is active in background) and the WatchkitApp (which sends requests to main App through the watchkit extension). Everything works fine in standalone, but no way to make it work simultaneously.
My main concern is to understand this message when trying to attach a process: what does this mean ?
Xcode couldn't attach to "myApp"
"myApp" does not support a debuggable architecture
Thank you.
Edit:
I just read that main app in ObjectiveC and watch app in swift is a problem: https://mkswap.net/m/blog/How+to+debug+an+iOS+app+while+the+WatchKit+app+is+currently+running+in+the+simulator
It happened to me when an extension process was hanging around refusing to terminate. Find and kill it in the Activity Monitor.
Actually, I had that same error message, and I fixed it by resolving a bug that crashed my phone app on launch.
I didn't think to run just the phone in debug so I got confused too.
I'm running ObjC on the phone and Swift on the Watch App.

Use multiple crash reporter on iOS

We successfully use TestFlightLive as our crash reporter, but I think some features are missing. These missing features are in another crash reporter: Crashlytics, but as of now I'm not willig to switch crash reporters completely. So I wonder if it's possible to use these both crash reporters together in one app (which is meant to be in the app store in the future).
I run both TestFlight and Crashlytics together and they both report errors fine. Like Jens Kohl says above, it must be included after the TestFlight SDK is initialized. Here's my code:
#ifdef DEBUG
// setup testflight if in debug (ie dev) mode
[TestFlight takeOff:kTestFlightAPIKey];
#endif
[Crashlytics startWithAPIKey:kCrashlyticsAPIKey];
You can only use 1 crash reporting framework. The framework catching the crash lets the other framework either not catch it or get wrong data since there is already new code executed on the thread.

Resources