horizontalsystems/ethereum-kit-ios

Crash when integrating with Firebase

elbelga opened this issue · 1 comments

  • Xcode version: 12.4
  • Firebase SDK version: 7.6.0
  • Installation method: `CocoaPods

I integrate Firebase in my app, and when I run the app it crash. It's something related with sqlite but I don't know what's is wrong . If I remove EthereumKit dependency the app not crash.

Steps to reproduce:

Create a blank app with the following dependencies

pod 'Firebase/Crashlytics'
pod 'Firebase/Core'
pod 'EthereumKit.swift'

Add a GoogleService-Info.plist and add call to FirebaseApp.configure() in AppDelegate
Run the app and you receive the following crash

Crashed: com.google.fira.worker
0  EthereumKit                    0x10fe7c0f0 load_descriptor_values + 64
1  EthereumKit                    0x10fe7c0a4 pb_field_iter_begin + 84
2  EthereumKit                    0x10fe87375 pb_encode + 53
3  Wallet                         0x10e3cb453 nano_two_pass_encoding + 62
4  Wallet                         0x10e3a891f apmpb_encode_measurement_bundle + 93
5  Wallet                         0x10e3b2c8a -[APMPBMeasurementBundle protoBuffer] + 33
6  Wallet                         0x10e3527c3 -[APMDatabase insertIfNotExistsRawEventMetadata:error:] + 68
7  Wallet                         0x10e3889e6 -[APMMeasurement(Event) writeEvent:isPublicEvent:isRealtime:] + 1248
8  Wallet                         0x10e385f04 __49-[APMMeasurement(Event) writeEventOnWorkerQueue:]_block_invoke + 668
9  Wallet                         0x10e3c6d42 -[APMSqliteStore performTransactionWithError:block:] + 188
10 Wallet                         0x10e3517ec -[APMDatabase performTransaction:] + 48
11 Wallet                         0x10e385b89 -[APMMeasurement(Event) writeEventOnWorkerQueue:] + 833
12 Wallet                         0x10e3856a3 -[APMMeasurement(Event) handleEventOnWorkerQueue:] + 559
13 Wallet                         0x10e39489c -[APMMeasurement logEventOnWorkerQueue:notifyEventListeners:] + 72
14 Wallet                         0x10e3947e5 -[APMMeasurement logEventOnWorkerQueueWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:] + 673
15 Wallet                         0x10e3944a1 __151-[APMMeasurement logEventWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:]_block_invoke + 76
16 Wallet                         0x10e3bad35 __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 29
17 libdispatch.dylib              0x7fff2010532f _dispatch_call_block_and_release + 12
18 libdispatch.dylib              0x7fff20106508 _dispatch_client_callout + 8
19 libdispatch.dylib              0x7fff2010c3f9 _dispatch_lane_serial_drain + 715
20 libdispatch.dylib              0x7fff2010cf74 _dispatch_lane_invoke + 403
21 libdispatch.dylib              0x7fff20117577 _dispatch_workloop_worker_thread + 782
22 libsystem_pthread.dylib        0x7fff61167499 _pthread_wqthread + 314
23 libsystem_pthread.dylib        0x7fff61166467 start_wqthread + 15

I have also opened an issue to Firebase and we are investigating the problem, any ideas?

I have opened an issue to Firebase, and the problem is a conflict with nanopb.

It looks like EthereumKit.swift/EthereumKit/Libraries/lib/libIncubed.a includes a binary version of pb_encode that is intercepting the version from the nanopb CocoaPod that the GoogleAppMeasurement CocoaPod expect to use.

firebase/firebase-ios-sdk#7522

It's possible to add PB_FIELD_32BIT=1 PB_NO_PACKED_STRUCTS=1 PB_ENABLE_MALLOC=1 to nanopb included in EthereumKit?