NSNoob
NSNoob

Reputation: 5628

iOS Fabric Crashlytics Answers Kit not Collecting Data

Problem Summary

UPDATE: I have fixed the issue somehow, I am not sure how. I just deleted the Apps from my dashboard, recreated them, cleaned the Fabrics and Crashlytics Cache and after four or five times trying, it started working out of its own accord. I am still interested in knowing how did it happen and how can it actually be solved without deleting the app altogether.

TL;DR I am not receiving any stats from Answers kit and it looks like Fabric thinks Answers is not installed in my App even though it is. I am not interested in events tracking, I just need the metrics stats.

Problem Explained

Fabric Crashlytics kit comes bundled together with Answers and for most of my Apps, whenever I set up Crashlytics, Answers is set up too and I can see stats on my Fabric Dashboard.

However for a couple of my apps, I can't see the stats and it seems like Answers is disabled. The Dashboard says for viewing stats, Answers is required.

But when I look at my Fabric Mac Client, It says that for this App, Answers kit is installed and enabled.

So let's head back to the web dashboard for the App, all the options for stats are disabled except Crashlytics and the App itself is kind of greyed out unlike other Apps.

And in details it first keeps waiting for "Events" and recommends that I should make a fresh installation of the App (Which I have done a number of times now).

After a while, it says no events were received and it asks me to perform a fresh install and enable debugging mode.

My Configuration

My pod file is:

pod 'Fabric'
pod 'Crashlytics'

I am setting up my Fabric kit in AppDelegate like:

[Fabric with:@[[Crashlytics class]]];

And I have enabled the debugging mod like:

[[Fabric sharedSDK] setDebug: YES];

What I have done so far

  1. Made sure Answers is installed.
  2. Enabled debugging mode. Fabric says it can tell me if Answers is enabled and sending events but I haven't seen any log regarding it. The only three logs I receive are the version number and notifications that Settings have been downloaded and are available for consumption.
  3. Made Fresh Installations
  4. Checked logs of debugging mode which confirm that the settings for Fabric have been downloaded and are ready for consumption.
  5. Added Fastlane Kit to create build deliveries to see if there was some problem with communication between my App and Fabric. The Builds are showing correctly and are being uploaded correctly but again, no Answers.

I have even logged a login event even though I don't need it, just to see if it starts transmitting Answers data.

[Answers logLoginWithMethod:@"Email"
                        success:@YES
               customAttributes:@{}];

There is also this interesting log when App runs:

[FileManager] Failed to remove file '/var/mobile/Containers/Data/Application/F055EE71-5064-4105-B41D-BD098F28DAA9/Library/Caches/com.crashlytics.data/com.sampleapp.mysampleapp/v3/launchmarker' : Error Domain=NSCocoaErrorDomain Code=4 "“launchmarker” couldn’t be removed." UserInfo={NSUnderlyingError=0x14e6a830 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}, NSFilePath=/var/mobile/Containers/Data/Application/F055EE71-5064-4105-B41D-BD098F28DAA9/Library/Caches/com.crashlytics.data/com.sampleapp.mysampleapp/v3/launchmarker, NSUserStringVariant=(
    Remove
)}

It pops up whenever I attempt a fresh install after resetting the simulator. Also, check the settings json in Fabrics Data in Cache. The curious bits here:

"features": {
    "collect_logged_exceptions": true,
    "collect_reports": false,
    "collect_analytics": false,
    "prompt_enabled": false,
    "push_enabled": true
  }

Complete JSON can be seen here.

How can I fix this?

Upvotes: 4

Views: 4464

Answers (4)

Witrakor Chanthong
Witrakor Chanthong

Reputation: 1

For Swift

First head to only Crashlytics manual, and Xcode

  1. I Install it on my app. then you will get 'welcome email from Crashlytics'

  2. I try to test crash event following the instruction. https://fabric.io/kits/ios/crashlytics/features

On Web UI of Fabric,

  1. I see the crash event generated.

Back to Xcode

  1. Stop debugging, And I try to delete the line of code that makes the app crashed and put Answer event trigger instead, from https://fabric.io/kits/ios/answers/features (change just one line of code) then Run again, I try to click to run the event

Go to Fabric Web UI

  1. Click to the other page of web UI e.g. Retention, Growth etc.

  2. Fabric web UI shows the term & condition request you to enable.

From now on Fabric UI is still showing 'waiting for the event'

  1. You receipt email from fabric, the detail is "Fabric analytics has just been enabled by you"

  2. Stop debugging your app from Xcode

  3. Delete your app from iPhone or simulator

  4. Click Run your app again from Xcode

  5. Try to click button generated event.

  6. Fabric UI dialogue received the trigger event.

  7. That's it. successful

This is my all step after I struggled for many hours. Hope this will help you.

Upvotes: 0

Christopher Larsen
Christopher Larsen

Reputation: 1411

Answering this in 2018 in case someone runs across it. I needed to be connected to wifi for the event to send to Fabric. Either it won't send over cellular or my phone had a bad connection. Worked immediately over wifi.

Upvotes: 1

Mike Bonnell
Mike Bonnell

Reputation: 16249

Mike from Fabric here. Yes, Answers is included within Crashlytics, however no data is collected until you enable it on the Fabric dashboard and accept the terms and conditions specific to Answers. What you need to do is include Crashlytics and once the app is active in your dashboard, then head to any other page in the dashboard and enable Answers from the web UI.

After that, we wait for two minutes to see if we see any event data. Usually, running a clean of your app, build and run (or un-install and re-install) will get the data sent over and then make the dashboard visible. As to why it didn't work earlier in your app, it's still unclear to me, but perhaps a race condition or one of our caches didn't propagate the data correctly.

Edit: Added a picture of what the button to enable Answers looks like.

enter image description here

Upvotes: 0

Pætur Magnussen
Pætur Magnussen

Reputation: 921

I think that your AppDelegate should look like this:

[Fabric with:@[[Crashlytics class], [Answers class]]];

Upvotes: 0

Related Questions