Firebase Analytics Crash on Unity iOS

1,246 views
Skip to first unread message

Anshul

unread,
May 18, 2017, 10:58:50 AM5/18/17
to Firebase Google Group
Hi,

I am trying to integrate firebase analytics in unity app for IOS platform. I added some log events in my code.

While running on device, game crashes on first log event having uncaught exception in Firebase::App::Create() function.

Please help.

Just another query:
In GoogleService-info.plist file, I noticed only IS_ANALYTICS_ENABLED boolean is NO, all other booleans are YES but I am using firebase analytics only. Is this normal.

Ian Barber

unread,
May 18, 2017, 1:40:16 PM5/18/17
to Firebase Google Group
the IS_ANALYTICS_ENABLED boolean being NO is fine - that's actually an older bit of config the refers to Google Analytics Mobile. 

Regarding the crash you see, do you have a stack trace or anything else on that? 

Anshul

unread,
May 19, 2017, 10:11:06 AM5/19/17
to Firebase Google Group
Hi,

Here is the stack trace :

* thread #53, queue = 'clearcut', stop reason = signal SIGABRT

  * frame #0: 0x24715c84 libsystem_kernel.dylib`__pthread_kill + 8

    frame #1: 0x247b7b46 libsystem_pthread.dylib`pthread_kill + 62

    frame #2: 0x246ac0c4 libsystem_c.dylib`abort + 108

    frame #3: 0x242267dc libc++abi.dylib`abort_message + 108

    frame #4: 0x2423f6a0 libc++abi.dylib`default_terminate_handler() + 268

    frame #5: 0x2424b098 libobjc.A.dylib`_objc_terminate() + 192

    frame #6: 0x2423ce16 libc++abi.dylib`std::__terminate(void (*)()) + 78

    frame #7: 0x2423c5f4 libc++abi.dylib`__cxa_throw + 112

    frame #8: 0x2424aed2 libobjc.A.dylib`objc_exception_throw + 250

    frame #9: 0x24a839d0 CoreFoundation`+[NSObject(NSObject) doesNotRecognizeSelector:] + 188

    frame #10: 0x24a8170e CoreFoundation`___forwarding___ + 702

    frame #11: 0x249b0c88 CoreFoundation`_CF_forwarding_prep_0 + 24

    frame #12: 0x0185c5b8 arrowforce`-[FIRNetwork postURL:payload:queue:usingBackgroundSession:completionHandler:] + 348

    frame #13: 0x017c8942 arrowforce`-[FIRClearcutLogger sendNextPendingRequestWithCompletionHandler:] + 606

    frame #14: 0x017c8376 arrowforce`-[FIRClearcutLogger sendLogsWithCompletionHandler:] + 534

    frame #15: 0x0517bcbe libdispatch.dylib`_dispatch_call_block_and_release + 10

    frame #16: 0x051865c2 libdispatch.dylib`_dispatch_queue_drain + 2014

    frame #17: 0x0517eefa libdispatch.dylib`_dispatch_queue_invoke + 282

    frame #18: 0x05188016 libdispatch.dylib`_dispatch_root_queue_drain + 1802

    frame #19: 0x05187908 libdispatch.dylib`_dispatch_worker_thread3 + 100

    frame #20: 0x247b4e0c libsystem_pthread.dylib`_pthread_wqthread + 1024

    frame #21: 0x247b49fc libsystem_pthread.dylib`start_wqthread + 8

Stewart Miles

unread,
May 19, 2017, 11:33:09 AM5/19/17
to Firebase Google Group
The stack trace isn't very informative unfortunately, could you share:
  • Log output of the application leading up to the crash - this should contain any backtraces for C# exceptions or useful error messages that you may have overlooked.
  • Unity version
  • Xcode version
  • Firebase Unity SDK version
  • OSX version (not sure how this would make a difference but it may be useful to reproduce)
  • Minimal reproducible case for the crash.  i.e does this crash if you build our analytics sample 
    https://github.com/firebase/quickstart-unity/tree/master/analytics/testapp ?
Cheers,
Stewart

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c1d7c8a6-9814-4a53-9a1d-ecacbe369b6a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Anshul

unread,
May 20, 2017, 11:17:46 AM5/20/17
to Firebase Google Group
Please find attached a full stack trace. May be it helps.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
stacktrace.txt

Anshul

unread,
May 22, 2017, 10:25:58 AM5/22/17
to Firebase Google Group
It does crash on analytics sample project, please download from following link:

Anshul

unread,
May 22, 2017, 10:26:05 AM5/22/17
to Firebase Google Group
Hi,

Here is the log output:

2017-05-22 12:44:42.751170 arrowforce[866:106037] +[NSData gtm_dataByGzippingData:error:]: unrecognized selector sent to class 0x37ab566c

2017-05-22 12:44:42.990592 arrowforce[866:106037] Uncaught exception: NSInvalidArgumentException: +[NSData gtm_dataByGzippingData:error:]: unrecognized selector sent to class 0x37ab566c

(

0   CoreFoundation                      0x1b726e1f <redacted> + 154

1   libobjc.A.dylib                     0x1a987077 objc_exception_throw + 38

2   CoreFoundation                      0x1b72c477 <redacted> + 0

3   CoreFoundation                      0x1b72a589 <redacted> + 700

4   CoreFoundation                      0x1b64ff08 _CF_forwarding_prep_0 + 24

5   arrowforce                          0x01867dc9 -[FIRNetwork postURL:payload:queue:usingBackgroundSession:completionHandler:] + 348

6   arrowforce                          0x017d4153 -[FIRClearcutLogger sendNextPendingRequestWithCompletionHandler:] + 606

7   arrowforce                          0x017d3b87 -[FIRClearcutLogger sendLogsWithCompletionHandler:] + 534

8   libdispatch.dylib                   0x0538fd67 _dispatch_call_block_and_release + 10

9   libdispatch.dylib                   0x0539bed9 _dispatch_queue_serial_drain + 980

10  libdispatch.dylib                   0x05393215 _dispatch_queue_invoke + 556

11  libdispatch.dylib                   0x0539c407 _dispatch_queue_override_invoke + 410

12  libdispatch.dylib                   0x0539dde1 _dispatch_root_queue_drain + 408

13  libdispatch.dylib                   0x0539dbe9 _dispatch_worker_thread3 + 112

14  libsystem_pthread.dylib             0x1af82937 _pthread_wqthread + 1168

15  libsystem_pthread.dylib             0x1af8248c start_wqthread + 8

)

2017-05-22 12:44:42.995229 arrowforce[866:106037] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSData gtm_dataByGzippingData:error:]: unrecognized selector sent to class 0x37ab566c'

*** First throw call stack:

(0x1b726e07 0x1a987077 0x1b72c477 0x1b72a589 0x1b64ff08 0x1867dc9 0x17d4153 0x17d3b87 0x538fd67 0x539bed9 0x5393215 0x539c407 0x539dde1 0x539dbe9 0x1af82937 0x1af8248c)

libc++abi.dylib: terminating with uncaught exception of type NSException


XCode Version: 8.3.2

Unity Version: 5.4

SDK version: 4.0.0

OS version: 10.12.1


On Saturday, May 20, 2017 at 8:47:46 PM UTC+5:30, Anshul wrote:

Stewart Miles

unread,
May 22, 2017, 9:05:02 PM5/22/17
to Firebase Google Group
Hi Anshul,

The current Unity SDK version is 3.0.3, are you referring to the iOS SDK at version 4.0.0?

I just built the Analytics sample project for the iOS simulator SDK and verified that it works with my build environment (i.e no crash) using Unity 5.4.1, Xcode 8.2.1, OSX 10.12.4, Firebase Unity SDK 3.0.3.

I took a look at your zip file and I didn't see a generated Xcode project in there to examine.
What I did see however is a set of Firebase frameworks manually dropped into the project.  You should not be doing this as you're probably missing transitive dependencies of the frameworks.  Instead we recommend using the built in Cocoapods support.

You should make sure Cocoapods support is enabled (maybe you turned it off?):


After this is enabled just build / run as per usual.

If this isn't available (it looks like it was disabled in your project):

$ grep -A 2 'Editor:' ./Assets/PlayServicesResolver/Editor/Google.IOSResolver.dll.meta
    Editor:
      enabled: 0
      settings:

Re-enable the Play Services Resolver components (i.e everything under Assets/PlayServicesResolver/Editor):

Cheers,
Stewart 

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Anshul

unread,
May 23, 2017, 10:16:13 AM5/23/17
to Firebase Google Group
Hi,

Yes you are right. Unity SDK version is 3.0.3 and iOS firebase analytics framework version is 4.0.0.

I manually added iOS frameworks as I cannot use Cocoapods. Is there any instructions available how to integrate your SDK without using Cocoapods?

P.S. Sorry but I didn't get your last point on how to reenable the Play Services Resolver components and what it does?

Stewart Miles

unread,
May 23, 2017, 11:15:16 AM5/23/17
to Firebase Google Group
Play Services Resolver is partially documented here, it performs:
  • Android dependency resolution - you will not be able to build for Android without a lot of pain without it.
  • iOS Cocoapods integration - if you don't use pods you'll end up with a brittle build as you'll need to manage all dependencies manually which can - and do - change between releases.
I'm curious why you can't use Cocoapods, can you share the details?

If you really can't use Cocoapods, our iOS manual setup docs are here https://firebase.google.com/docs/ios/setup#frameworks 

Cheers,
Stewart


To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Anshul

unread,
May 24, 2017, 10:39:43 AM5/24/17
to Firebase Google Group
Hi,

Still facing same issue. Please download the sample app from the link given below with XCode project too. (Folder name : iOSBuild).


Jeremie Auboux

unread,
Jun 14, 2017, 3:31:19 PM6/14/17
to Firebase Google Group
Hi,
we are in the same situation because cocoapods won't work (at least for us) in Unity Cloud Build
It's been a while that UCB is supposed to support cocoa pods, but in the end we still end up with a link error

From what I understood by searching through the UCB logs, UCB generates a podfile for Xcode workspace because it is Firebase package default option, and there is no way to transfer the firebase preferences to UCB because they are not saved in the project:

[Unity] Cocoapods tools successfully installed.
...
[Unity] Generating Podfile /BUILD_PATH/ooblada-paris.firebasesample.default-ios/temp.beFVJR/Podfile with Xcode workspace integration.
...
[Unity] Analyzing dependencies
[Unity] Downloading dependencies
[Unity] Installing Firebase (4.0.2)
[Unity] Installing FirebaseAnalytics (4.0.1)
[Unity] Installing FirebaseCore (4.0.2)
[Unity] Installing FirebaseInstanceID (2.0.0)
[Unity] Installing GoogleToolboxForMac (2.1.1)
[Unity] Generating Pods project
[Unity] Integrating client project
[Unity] [!] Please close any current Xcode sessions and use `Unity-iPhone.xcworkspace` for this project from now on.
[Unity] Sending stats
[Unity] Pod installation complete! There are 2 dependencies from the Podfile and 5 total pods installed.

...

But it looks like UCB tries to compile using the .xcodeproj instead of the .xcworkspace, sinc e it gives the same linke error as if we had tried to build locally the xcode project, instead of xcode workspace

       [xcode] ld: warning: directory not found for option '-L/BUILD_PATH/Library/Developer/Xcode/DerivedData/Unity-iPhone-haqsbnkqfxaycnaawyfsksqpbvff/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/BuildProductsPath/Release-iphoneos/GoogleToolboxForMac'
       [xcode] ld: library not found for -lGoogleToolboxForMac
       [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation)
       [xcode] ** ARCHIVE FAILED **
       [xcode] The following build commands failed:
       [xcode] 	Ld /BUILD_PATH/Library/Developer/Xcode/DerivedData/Unity-iPhone-haqsbnkqfxaycnaawyfsksqpbvff/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/APPLICATION_PATH/poseidon.app/poseidon normal armv7
       [xcode] (1 failure)


Jeremie

Stewart Miles

unread,
Jun 15, 2017, 6:35:33 PM6/15/17
to Firebase Google Group
You can disable pod integration using the editor API:


IOSResolver.PodfileGenerationEnabled = false;
// Your code to kick off the build.




To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages