Skip to content

Integration with GoogleTagManager will crash the app at startup #3921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AndreaVitale opened this issue Sep 25, 2019 · 17 comments
Closed

Integration with GoogleTagManager will crash the app at startup #3921

AndreaVitale opened this issue Sep 25, 2019 · 17 comments

Comments

@AndreaVitale
Copy link

AndreaVitale commented Sep 25, 2019

[READ] Step 1: Are you in the right place?

I think yes because it is similar to this issue: #2059

[REQUIRED] Step 2: Describe your environment

  • Xcode version: 10.3
  • Firebase SDK version: 6.8.1
  • Firebase Component: Core, Analytics
  • Component version: unknown because i picked FirebaseCore.framework and FirebaseAnalytics.framework from this 6.8.1 bundle

[REQUIRED] Step 3: Describe the problem

I'm trying to create a Titanium Module that include Google Tag Manager using Firebase Analytics as a datalayer. I've followed this official guide and I'm trying to use GoogleTagManager 7.1.2.

The module builds fine and the app will run fine until I call [FIRApp configure] method and then the app will crash immediately.

Steps to reproduce:

Here are all the included frameworks inside the Titanium Module iOS project that I got from Firebase/Analytics 6.8.1 bundle folder:

image

Running the app and opening Console app on my mac I can see these messages

default	16:34:32.366979 +0200	tests	GoogleTagManager info: Loading container: GTM-T3DH88D
default	16:34:32.406538 +0200	tests	GoogleTagManager info: Attempting to load saved version of container GTM-T3DH88D

so the library correctly tries to load my container.

Opening the .crash file from DiagnosticReports I can see this output:

Crashed Thread:        4  Dispatch queue: TagManagerContainerQueue

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Note:        EXC_CORPSE_NOTIFY

where the crashed thread is

Thread 4 Crashed:: Dispatch queue: TagManagerContainerQueue
0   com.apple.JavaScriptCore      	0x000000010739e679 WTF::String::isolatedCopy() const & + 9
1   com.apple.JavaScriptCore      	0x000000010752e0b2 OpaqueJSString::string() const + 18
2   com.apple.JavaScriptCore      	0x0000000107515910 JSEvaluateScript + 160
3   com.apple.JavaScriptCore      	0x00000001074f2b02 -[JSContext evaluateScript:withSourceURL:] + 194
4   comehome                      	0x0000000106f17815 -[TAGRuntime initWithContainerId:resource:hitStore:dispatchScheduler:] + 450
5   comehome                      	0x0000000106f0dae8 __55-[TAGContainer handleLoadOfContainerData:errorMessage:]_block_invoke + 274
6   libdispatch.dylib             	0x00000001101e6ccf _dispatch_call_block_and_release + 12
7   libdispatch.dylib             	0x00000001101e7d02 _dispatch_client_callout + 8
8   libdispatch.dylib             	0x00000001101ee720 _dispatch_lane_serial_drain + 705
9   libdispatch.dylib             	0x00000001101ef261 _dispatch_lane_invoke + 398
10  libdispatch.dylib             	0x00000001101f7fcb _dispatch_workloop_worker_thread + 645
11  libsystem_pthread.dylib       	0x00000001105c9611 _pthread_wqthread + 421
12  libsystem_pthread.dylib       	0x00000001105c93fd start_wqthread + 13

Relevant Code:

The only code that I run at startup is:

[FIRApp configure];
DebugLog(@"App instance id: %@", [FIRAnalytics appInstanceID]);

and I can correctly see this log message:

[DEBUG] App instance id: 8C7CD2DA60C24EEBA6EF2304353895C8

I attach here the entire crash report file.

tests_2019-09-25-163437_MacBook-Pro-di-Andrea-2.txt

@bhanubirani
Copy link

Hey guys - did anyone had any update here? I'm also facing the similar crash where Firebase SDK just crash at launch.

Any help/lead would be appreciated..

@morganchen12
Copy link
Contributor

Can you share the version of GoogleTagManager as well?

@AndreaVitale
Copy link
Author

7.1.2

@bhanubirani
Copy link

Here is the crash logs:

2019-09-26 10:33:26.857239+0530 Demo-App[3718:459023] 4.13.0 - [Firebase/Analytics][I-ACS036002] Firebase screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist

Sep 26 10:33:27 Demo-App[3718] : [458863] Failed to enable location services
2019-09-26 10:33:27.259587+0530 Demo-App[3718:459024] 4.13.0 - [Firebase/Core][I-COR000001] Configuring the default app.
2019-09-26 10:33:27.348556+0530 Demo-App[3718:459040] 4.13.0 - [Firebase/InstanceID][I-IID013002] Removed cached checkin preferences from Keychain.
2019-09-26 10:33:27.348604+0530 Demo-App[3718:459040] 4.13.0 - [Firebase/InstanceID][I-IID013009] App reset detected but no valid checkin auth preferences found. Will not delete server registrations.
2019-09-26 10:33:27.348671+0530 Demo-App[3718:459040] 4.13.0 - [Firebase/InstanceID][I-IID013010] InstanceID library version 2.0.10
2019-09-26 10:33:27.349640+0530 Demo-App[3718:459023] 4.13.0 - [Firebase/Analytics][I-ACS024000] Debug mode is on
2019-09-26 10:33:27.349984+0530 Demo-App[3718:459023] 4.13.0 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40200000 started
2019-09-26 10:33:27.350163+0530 Demo-App[3718:459023] 4.13.0 - [Firebase/Analytics][I-ACS023008] To disable debug logging set the following application argument: -noFIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2019-09-26 10:33:27.350803+0530 Demo-App[3718:459023] 4.13.0 - [Firebase/Analytics][I-ACS023009] Debug logging enabled
2019-09-26 10:33:27.377400+0530 Demo-App[3718:459020] 4.13.0 - [Firebase/InstanceID][I-IID015013] Successfully removed all IID tokens
2019-09-26 10:33:27.378892+0530 Demo-App[3718:459020] 4.13.0 - [Firebase/InstanceID][I-IID007006] Checkin parameters: {
checkin = {
iosbuild = {
model = "iPhone8,1";
"os_version" = "IOS_11.4.1";
};
"last_checkin_msec" = 0;
type = 2;
"user_number" = 0;
};
digest = "";
fragment = 0;
id = 0;
locale = "en-IN";
"logging_id" = 2967862199;
"security_token" = 0;
timezone = "Asia/Kolkata";
"user_serial_number" = 0;
version = 2;
}

2019-09-26 10:33:27.792074+0530 Demo-App[3718:459042] 4.13.0 - [Firebase/Analytics][I-ACS013002] Event name must contain only letters, numbers, or underscores: App Update Required
2019-09-26 10:33:27.817883+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: MMDrawerController, 582672373077141217

directory: Error Domain=NSCocoaErrorDomain Code=260 "The file “_etag_field_validation.json” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/B5B94CD6-A649-4CF5-9E02-1E8342BE4E02/Documents/_etag_field_validation.json, NSUnderlyingError=0x1c0258330 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

2019-09-26 10:33:27.877273+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2019-09-26 10:33:27.877513+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: SplashScreenView, 582672373077141218
2019-09-26 10:33:27.878744+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2019-09-26 10:33:27.879082+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: SplashScreenView, 582672373077141218
2019-09-26 10:33:27.879291+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS003007] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist

2019-09-26 10:33:27.892551+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS902004] Network status has changed. Code, status: 3, Connected

2019-09-26 10:33:28.064550+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: SignInFormEntryView, 582672373077141219
2019-09-26 10:33:28.069353+0530 Demo-App[3718:459039] 4.13.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: SignInFormEntryView, 582672373077141219
2019-09-26 10:33:28.124327+0530 Demo-App[3718:459051] 4.13.0 - [Firebase/InstanceID][I-IID007002] Invalid last checkin timestamp in future.
2019-09-26 10:33:28.125456+0530 Demo-App[3718:459051] 4.13.0 - [Firebase/InstanceID][I-IID007003] Checkin successful with authId: 4965763581955321689, digest: SnO7g8DgprHW8e+Cl2EyBQ==, lastCheckinTimestamp: 1569474208000
2019-09-26 10:33:28.125551+0530 Demo-App[3718:459051] 4.13.0 - [Firebase/InstanceID][I-IID005004] Successfully got checkin credentials
2019-09-26 10:33:28.127809+0530 Demo-App[3718:459051] 4.13.0 - [Firebase/InstanceID][I-IID005002] Checkin success.
2019-09-26 10:33:28.168939+0530 Demo-App[3718:459041] 4.13.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: SignInFormEntryView, 582672373077141219
2019-09-26 10:33:28.189492+0530 Demo-App[3718:459041] TIC Read Status [1:0x0]: 1:57
2019-09-26 10:33:28.189535+0530 Demo-App[3718:459041] TIC Read Status [1:0x0]: 1:57
2019-09-26 10:33:28.431590+0530 Demo-App[3718:459041] TIC Read Status [3:0x0]: 1:57
2019-09-26 10:33:28.431633+0530 Demo-App[3718:459041] TIC Read Status [3:0x0]: 1:57
(lldb)

Stack trace:
CoreFoundation`CFStringGetLength:
0x18470acc8 <+0>: tbz x0, #0x3f, 0x18470acd8 ; <+16>
0x18470accc <+4>: adrp x8, 199791
0x18470acd0 <+8>: ldr x1, [x8, #0x308]
0x18470acd4 <+12>: b 0x183a10900 ; objc_msgSend
-> 0x18470acd8 <+16>: ldr x8, [x0]
0x18470acdc <+20>: adrp x9, 206039
0x18470ace0 <+24>: add x9, x9, #0x5d8 ; =0x5d8
0x18470ace4 <+28>: ldr x9, [x9]
0x18470ace8 <+32>: cmp x8, #0x0 ; =0x0
0x18470acec <+36>: ccmp x8, x9, #0x4, ne
0x18470acf0 <+40>: b.eq 0x18470ad44 ; <+124>
0x18470acf4 <+44>: adrp x9, 206040
0x18470acf8 <+48>: ldr x9, [x9, #0x5d8]
0x18470acfc <+52>: cmp x9, #0x3ff ; =0x3ff
0x18470ad00 <+56>: b.hi 0x18470ad38 ; <+112>
0x18470ad04 <+60>: adrp x10, 206037
0x18470ad08 <+64>: add x10, x10, #0x5d0 ; =0x5d0
0x18470ad0c <+68>: ldr x9, [x10, x9, lsl #3]
0x18470ad10 <+72>: cmp x8, x9
0x18470ad14 <+76>: b.eq 0x18470ad44 ; <+124>
0x18470ad18 <+80>: tbz w8, #0x0, 0x18470accc ; <+4>
0x18470ad1c <+84>: adrp x10, 174661
0x18470ad20 <+88>: ldr x10, [x10, #0x8e8]
0x18470ad24 <+92>: ldr x10, [x10]
0x18470ad28 <+96>: and x8, x10, x8
0x18470ad2c <+100>: cmp x8, x9
0x18470ad30 <+104>: b.ne 0x18470accc ; <+4>
0x18470ad34 <+108>: b 0x18470ad44 ; <+124>
0x18470ad38 <+112>: mov x9, #0x0
0x18470ad3c <+116>: cmp x8, x9
0x18470ad40 <+120>: b.ne 0x18470ad18 ; <+80>
0x18470ad44 <+124>: add x8, x0, #0x8 ; =0x8
0x18470ad48 <+128>: ldar x9, [x8]
0x18470ad4c <+132>: mov w10, #0x5
0x18470ad50 <+136>: and x10, x9, x10
0x18470ad54 <+140>: ldar x8, [x8]
0x18470ad58 <+144>: and x9, x8, #0x60
0x18470ad5c <+148>: cmp x10, #0x4 ; =0x4
0x18470ad60 <+152>: b.ne 0x18470ad78 ; <+176>
0x18470ad64 <+156>: add x8, x0, #0x10 ; =0x10
0x18470ad68 <+160>: cbz x9, 0x18470ad84 ; <+188>
0x18470ad6c <+164>: ldr x8, [x8]
0x18470ad70 <+168>: ldrb w0, [x8]
0x18470ad74 <+172>: ret
0x18470ad78 <+176>: cbz x9, 0x18470adac ; <+228>
0x18470ad7c <+180>: ldr x0, [x0, #0x18]
0x18470ad80 <+184>: ret
0x18470ad84 <+188>: add x9, x0, #0x8 ; =0x8
0x18470ad88 <+192>: ldar x9, [x9]
0x18470ad8c <+196>: mov w10, #0x5
0x18470ad90 <+200>: and x9, x9, x10
0x18470ad94 <+204>: cmp x9, #0x4 ; =0x4
0x18470ad98 <+208>: orr w9, wzr, #0x8
0x18470ad9c <+212>: csel x9, xzr, x9, eq
0x18470ada0 <+216>: add x8, x9, x8
0x18470ada4 <+220>: ldrb w0, [x8]
0x18470ada8 <+224>: ret
0x18470adac <+228>: ldr x0, [x0, #0x10]
0x18470adb0 <+232>: ret

Here are the version we're using:

Using FirebaseAnalytics (4.2.0)
Using FirebaseCore (4.0.20)
Using FirebaseInstanceID (2.0.10)
Using GoogleAnalytics (3.17.0)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleTagManager (6.0.0)
Using GoogleToolboxForMac (2.2.1)
Using GoogleUtilities (1.3.2)
Using nanopb (0.3.901)

This crash happens as soon as GTM tries to read JSON we assume.

@ryanwilson
Copy link
Member

@baolocdo - would you be able to direct this to the right person?

@paulb777
Copy link
Member

The pod versions specified are quite old.

@AndreaVitale
Copy link
Author

@paulb777 the latest version in CocoaPods specs is 7.1.2.
Inside the official GTM and Firebase integration is reported 6.0 inside the Podfile example.. Which is the last version of GTM?

@paulb777
Copy link
Member

Right GTM is at 7.1.2 and Firebase is at 6.9.0. The Podfile.lock file should show what's causing earlier versions to get installed.

@AndreaVitale
Copy link
Author

AndreaVitale commented Sep 26, 2019

Here is the Podfile.lock content:

PODS:
  - FirebaseAnalytics (6.1.1):
    - FirebaseCore (~> 6.2)
    - FirebaseInstanceID (~> 4.2)
    - GoogleAppMeasurement (= 6.1.1)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GoogleUtilities/Network (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - nanopb (~> 0.3)
  - FirebaseCore (6.2.3):
    - FirebaseCoreDiagnostics (~> 1.0)
    - FirebaseCoreDiagnosticsInterop (~> 1.0)
    - GoogleUtilities/Environment (~> 6.2)
    - GoogleUtilities/Logger (~> 6.2)
  - FirebaseCoreDiagnostics (1.0.1):
    - FirebaseCoreDiagnosticsInterop (~> 1.0)
    - GoogleDataTransportCCTSupport (~> 1.0)
    - GoogleUtilities/Environment (~> 6.2)
    - GoogleUtilities/Logger (~> 6.2)
  - FirebaseCoreDiagnosticsInterop (1.0.0)
  - FirebaseInstanceID (4.2.5):
    - FirebaseCore (~> 6.0)
    - GoogleUtilities/Environment (~> 6.0)
    - GoogleUtilities/UserDefaults (~> 6.0)
  - GoogleAnalytics (3.17.0)
  - GoogleAppMeasurement (6.1.1):
    - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GoogleUtilities/Network (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - nanopb (~> 0.3)
  - GoogleDataTransport (1.2.0)
  - GoogleDataTransportCCTSupport (1.0.4):
    - GoogleDataTransport (~> 1.2)
    - nanopb
  - GoogleSymbolUtilities (1.1.2)
  - GoogleTagManager (7.1.2):
    - FirebaseAnalytics (~> 6.0)
    - GoogleAnalytics (~> 3.17)
    - GoogleUtilitiesLegacy (~> 1.3)
  - GoogleUtilities/AppDelegateSwizzler (6.2.5):
    - GoogleUtilities/Environment
    - GoogleUtilities/Logger
    - GoogleUtilities/Network
  - GoogleUtilities/Environment (6.2.5)
  - GoogleUtilities/Logger (6.2.5):
    - GoogleUtilities/Environment
  - GoogleUtilities/MethodSwizzler (6.2.5):
    - GoogleUtilities/Logger
  - GoogleUtilities/Network (6.2.5):
    - GoogleUtilities/Logger
    - "GoogleUtilities/NSData+zlib"
    - GoogleUtilities/Reachability
  - "GoogleUtilities/NSData+zlib (6.2.5)"
  - GoogleUtilities/Reachability (6.2.5):
    - GoogleUtilities/Logger
  - GoogleUtilities/UserDefaults (6.2.5):
    - GoogleUtilities/Logger
  - GoogleUtilitiesLegacy (1.3.2):
    - GoogleSymbolUtilities (~> 1.1)
  - nanopb (0.3.901):
    - nanopb/decode (= 0.3.901)
    - nanopb/encode (= 0.3.901)
  - nanopb/decode (0.3.901)
  - nanopb/encode (0.3.901)

DEPENDENCIES:
  - GoogleTagManager (~> 7.1.2)

SPEC REPOS:
  https://github.com/cocoapods/specs.git:
    - FirebaseAnalytics
    - FirebaseCore
    - FirebaseCoreDiagnostics
    - FirebaseCoreDiagnosticsInterop
    - FirebaseInstanceID
    - GoogleAnalytics
    - GoogleAppMeasurement
    - GoogleDataTransport
    - GoogleDataTransportCCTSupport
    - GoogleSymbolUtilities
    - GoogleTagManager
    - GoogleUtilities
    - GoogleUtilitiesLegacy
    - nanopb

SPEC CHECKSUMS:
  FirebaseAnalytics: 843c7f64a8f9c79f0d03281197ebe7bb1d58d477
  FirebaseCore: e9d9bd1dae61c1e82bc1e0e617a9d832392086a0
  FirebaseCoreDiagnostics: 4c04ae09d0ab027c30179828c6bb47764df1bd13
  FirebaseCoreDiagnosticsInterop: 6829da2b8d1fc795ff1bd99df751d3788035d2cb
  FirebaseInstanceID: 550df9be1f99f751d8fcde3ac342a1e21a0e6c42
  GoogleAnalytics: f42cc53a87a51fe94334821868d9c8481ff47a7b
  GoogleAppMeasurement: 86a82f0e1f20b8eedf8e20326530138fd71409de
  GoogleDataTransport: 8f9897b8e073687f24ca8d3c3a8013dec7d2d1cc
  GoogleDataTransportCCTSupport: 7455d07b98851aa63e4c05a34dad356ca588479e
  GoogleSymbolUtilities: 631ee17048aa5e9ab133470d768ea997a5ef9b96
  GoogleTagManager: 1821fef94a9648b63c6c3469077adcba4bff8dee
  GoogleUtilities: e7dc37039b19df7fe543479d3e4a02ac8d11bb69
  GoogleUtilitiesLegacy: 5501bedec1646bd284286eb5fc9453f7e23a12f4
  nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48

PODFILE CHECKSUM: aacda8cad016500393fa35a351d7295c3828c0c5

COCOAPODS: 1.7.5

All this dependencies (excluding GTM, GA, GoogleSymbolUtilities and GoogleUtilitiesLegacy) are in Firebase 6.9.0 bundle?

@paulb777
Copy link
Member

@AndreaVitale That all looks up to date. Yes those are Firebase dependencies.

The crash log from @bhanubirani is from old pods.

@AndreaVitale
Copy link
Author

@patm1987 ok, I was thinking you were talking to me.
About my issue could you point me in the right direction?

@paulb777
Copy link
Member

Routed to tag manager team with b/141770453

@AndreaVitale
Copy link
Author

AndreaVitale commented Sep 30, 2019

@paulb777 thank you. Is there a way to talk with someone from tag manager team?
If I could help with tests or with more debugging activity I'm of course available.

@ggjxnf
Copy link

ggjxnf commented Nov 10, 2019

@AndreaVitale, @paulb777
I have same issue and fixed it by adding TagManagerResources.bundle with TAGRuntime.js.dat to app target.
Just TAGRuntime.js.dat is not enough.
I'm using cocoapods rome.

@AndreaVitale
Copy link
Author

AndreaVitale commented Nov 15, 2019

@ggjxnf where I can find TagManagerResources.bundle?

I'm using CocoaPods with this PodFile content:

target 'TAGManager' do
  use_frameworks!
  pod 'GoogleTagManager', '~> 7.1.2'
end

and I only have this inpsecting my Pods folder:

Schermata 2019-11-15 alle 19 30 13

There is no TagManagerResource.bundle. Thanks!

@ggjxnf
Copy link

ggjxnf commented Nov 16, 2019

@AndreaVitale it's one of products/targets of tag manager. I'm using cocoapods rome and since it's not created automatically i created and added it manually
image

@AndreaVitale
Copy link
Author

Nice catch @ggjxnf ! It worked! Really thank you!

@firebase firebase locked and limited conversation to collaborators Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants