After moving to Xcode 9 with an existing project I’m keep receiving warnings from the Main Thread Checker about a queue called FIRAnalyticsQueue.
I found this MTC as an awesome feature, since I’ve already resolved quite a lot threading issues with it, but unfortunately I’m not able to eliminate the one regarding to Firebase configuration.
The code that I use in the AppDelegate didFinishLaunchingWithOptions function is the following:
if FIRApp.defaultApp() == nil {
FIRApp.configure()
}
And the log that I receives after evaluating the code above:
2017-10-05 16:14:34.965 PonySugarCandyApp[17721] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization.
2017-10-05 16:14:45.283 PonySugarCandyApp[17721] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.3700000 started
2017-10-05 16:14:52.139 PonySugarCandyApp[17721] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 17721, TID: 1309471, Thread name: (none), Queue name: FIRAnalyticsQueue, QoS: 9
Backtrace:
4 PonySugarCandyApp 0x000000010c5fe721 __38+[FIRAnalytics createAppDelegateProxy]_block_invoke + 55
5 libdispatch.dylib 0x000000011337143c _dispatch_client_callout + 8
6 libdispatch.dylib 0x00000001133729c7 dispatch_once_f + 297
7 PonySugarCandyApp 0x000000010c5fd519 __47+[FIRAnalytics startWithConfiguration:options:]_block_invoke_2 + 101
8 libdispatch.dylib 0x00000001133703f7 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x000000011337143c _dispatch_client_callout + 8
10 libdispatch.dylib 0x000000011337995b _dispatch_queue_serial_drain + 1162
11 libdispatch.dylib 0x000000011337a2df _dispatch_queue_invoke + 336
12 libdispatch.dylib 0x000000011337d1f9 _dispatch_root_queue_drain + 772
13 libdispatch.dylib 0x000000011337ce97 _dispatch_worker_thread3 + 132
14 libsystem_pthread.dylib 0x00000001138345a2 _pthread_wqthread + 1299
15 libsystem_pthread.dylib 0x000000011383407d start_wqthread + 13
(Recorded stack frame)
This has been fixed in the latest version of Firebase. Do a pod update to upgrade to Firebase 4.3.0. More details on the issue and fix at https://github.com/firebase/firebase-ios-sdk/issues/69.
I believe going to your project name and clicking edit scheme, you can go into your environment variables and add:
Name: "OS_ACTIVITY_MODE"
Value: "disable"
This should stop firebase from printing a bunch of text to your console when running your application.
This was an issue for me with the newest version of Firebase (as of 19/12/17) and this fix worked out ok.
See this Brian Voong tutorial for more information.
Related
I wrote a simple app with React Native targeting iOS. When I build the app in Xcode to test on simulators or my iPhone everything works perfectly. When I archive the build in Xcode and load it on my iPhone using the development option, it crashes when I press the only button on screen on start.
The app source code can be found on GitHub.
I am using React Native ~0.63.4 and React: 16.13.1 in a bare Expo workflow.
Third party dependencies:
#react-native-async-storage/async-storage
expo-constants
expo-notifications
uuid
react-native-date-picker
Here is a full crash report from the device logs: Google Drive
I'm at a loss trying to interpret the crash logs but the thread that crashes is exactly this everytime (except for the thread number):
Thread 3 name: Dispatch queue: com.facebook.react.ExceptionsManagerQueue
Thread 3 Crashed:
0 libsystem_kernel.dylib 0x00000001d285f414 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001eed77b40 pthread_kill + 272
2 libsystem_c.dylib 0x00000001aec84b74 abort + 104
3 libc++abi.dylib 0x00000001b9fbccf8 __cxxabiv1::__aligned_malloc_with_fallback+ 81144 (unsigned long) + 0
4 libc++abi.dylib 0x00000001b9fade4c demangling_unexpected_handler+ 20044 () + 0
5 libobjc.A.dylib 0x00000001b9eb6f64 _objc_terminate+ 28516 () + 144
6 libc++abi.dylib 0x00000001b9fbc0e0 std::__terminate(void (*)+ 78048 ()) + 20
7 libc++abi.dylib 0x00000001b9fbc06c std::terminate+ 77932 () + 44
8 libdispatch.dylib 0x00000001a5554dc4 _dispatch_client_callout + 40
9 libdispatch.dylib 0x00000001a555c10c _dispatch_lane_serial_drain + 580
10 libdispatch.dylib 0x00000001a555cc5c _dispatch_lane_invoke + 408
11 libdispatch.dylib 0x00000001a5566d78 _dispatch_workloop_worker_thread + 708
12 libsystem_pthread.dylib 0x00000001eed78804 _pthread_wqthread + 276
13 libsystem_pthread.dylib 0x00000001eed7f75c start_wqthread + 8
When I open the app while connected to my laptop and have the console for my iPhone open while crashing the app, I first get these messages under Errors and Faults:
error 16:14:06.383233-0500 remindrs Error: Requiring unknown module "undefined".
error 16:14:06.386759-0500 remindrs Unhandled JS Exception: Error: Requiring unknown module "undefined".
error 16:14:06.463315-0500 SpringBoard Ignoring state for untracked process [application<org.name.remindrs>:5966]: <RBSProcessState| task:none debug:none>
fault 16:14:06.559231-0500 SpringBoard Unable to move topic <private>, This topic was not in the list provided! APSTopicListOpportunistic
I've tried cleaning the build folder, turning off Swift compiler optimizations, and rearchived the project multiple times.
None of my searching has paid off and I'm not sure how to identify the issue I am having. I don't know if it is with React Native or with some configuration in Xcode.
Thank you for your help!
I solved the problem by removing a few lines of codes dealing with a Date. I'm not sure why this caused a crash in release and not debug but the problem is fixed!
We are using authentication by email link in our Flutter app with firebase_auth package, and we are seeing crashes on iOS devices with
Fatal Exception: NSInvalidArgumentException
The link provided is not valid for email/link sign-in. Please check the link by calling isSignInWithEmailLink:link: on Auth before attempting to use it for email/link sign-in.
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x18f2095f0 __exceptionPreprocess
1 libobjc.A.dylib 0x18ef2bbcc objc_exception_throw
2 CoreFoundation 0x18f0ffb28 -[NSCache init]
3 Runner 0x102fde5ec +[FIRAuthExceptionUtils raiseInvalidParameterExceptionWithReason:] + 30 (FIRAuthExceptionUtils.m:30)
4 Runner 0x102fcf970 -[FIRAuth internalSignInAndRetrieveDataWithEmail:link:callback:] + 729 (FIRAuth.m:729)
5 Runner 0x102fd0028 -[FIRAuth internalSignInAndRetrieveDataWithCredential:isReauthentication:callback:] + 770 (FIRAuth.m:770)
6 Runner 0x102fcef5c __43-[FIRAuth signInWithEmail:link:completion:]_block_invoke + 562 (FIRAuth.m:562)
7 libdispatch.dylib 0x18eece9a8 _dispatch_call_block_and_release
8 libdispatch.dylib 0x18eecf524 _dispatch_client_callout
9 libdispatch.dylib 0x18eeacb3c _dispatch_lane_serial_drain$VARIANT$armv81
10 libdispatch.dylib 0x18eead54c _dispatch_lane_invoke$VARIANT$armv81
11 libdispatch.dylib 0x18eeb684c _dispatch_workloop_worker_thread
12 libsystem_pthread.dylib 0x18ef20b74 _pthread_wqthread
13 libsystem_pthread.dylib 0x18ef23740 start_wqthread
We added some logging for investigation and saw that invalid link was
com.xxxx.xxxx://google/link/?request_ip_version=IP%5FV6&match_message=No%20pre%2Dinstall%20link%20matched%20for%20this%20device%2E
It seems that it doesn't affect 100% of users who are trying to log in with an email link and we were not able to reproduce it on our devices even once. What could produce a link like that?There doesn't seem to be any documentation that would mention this error message
Xcode 9 seems to be reporting a lot of Main thread calls to UIApplication properties. Even though the UI is not being updated this is particularly cumbersome due to the extension of logs it produces a default environment.
4 TestApp 0x0000000101c262e0 __39-[ViewController viewDidLoad]_block_invoke + 196
5 libdispatch.dylib 0x0000000102279654 _dispatch_call_block_and_release + 24
6 libdispatch.dylib 0x0000000102279614 _dispatch_client_callout + 16
7 libdispatch.dylib 0x0000000102289008 _dispatch_queue_serial_drain + 716
8 libdispatch.dylib 0x000000010227ce58 _dispatch_queue_invoke + 340
9 libdispatch.dylib 0x000000010228a1c4 _dispatch_root_queue_drain_deferred_wlh + 412
10 libdispatch.dylib 0x00000001022917fc _dispatch_workloop_worker_thread + 868
11 libsystem_pthread.dylib 0x00000001ac6771e8 _pthread_wqthread + 924
12 libsystem_pthread.dylib 0x00000001ac676e40 start_wqthread + 4
If these reporting messages confuse you uncheck them:
Edit Scheme...
Uncheck "Main Thread Checker" in Run > Diagnostics
Check also ARKit template Xcode project Main Thread Checker log console.
If UIApplication or UIApplicationDelegate method is called from another thread you can disable checking thread as in CGN answer, but it will disable this checker completely. You can also subclass what is necessary and call metod of superclass on main thread. This way you can still use Main Thread Sanitizer in other places in code
I'm using FMDB in an iOS app. Recently I have received several crash reports from Apteligent about a crash of FMDB:
0 libdispatch.dylib 0x00000001810ab120 _dispatch_main_queue_callback_4CF + 2904
! 1 myApp 0x00000001001ac840 -[FMDatabaseQueue inDatabase:] (FMDatabaseQueue.m:142)
2 myApp 0x000000010011844c +[DataBaseController insert:withObjects:] (DataBaseController.m:602)
3 myApp 0x0000000100118254 +[DataBaseController insertObjects:withObjects:] (DataBaseController.m:575)
4 myApp 0x0000000100150e80 -[SendManagementBBDD crearySalvarEnvioConSolicitud:EntidadParaEncolar:borrarTrasEnvio:] (SendManagementBBDD.m:686)
5 myApp 0x0000000100150a28 __76-[SendManagementBBDD sendEntitiesAfterDetail:OnComplete:]_block_invoke (SendManagementBBDD.m:615)
6 libdispatch.dylib 0x00000001810a55f0 _dispatch_client_callout + 12
7 libdispatch.dylib 0x00000001810b0b94 _dispatch_sync_f_invoke + 68
8 myApp 0x0000000100150404 -[SendManagementBBDD sendEntitiesAfterDetail:OnComplete:] (SendManagementBBDD.m:563)
9 myApp 0x000000010005c284 __44-[DetailVC startWork:]_block_invoke (DetailVC.m:286)
10 libdispatch.dylib 0x00000001810a5630 _dispatch_call_block_and_release + 20
11 libdispatch.dylib 0x00000001810a55f0 _dispatch_client_callout + 12
12 libdispatch.dylib 0x00000001810b3a88 _dispatch_root_queue_drain + 2136
13 libdispatch.dylib 0x00000001810b3224 _dispatch_worker_thread3 + 108
14 libsystem_pthread.dylib 0x00000001812b9470 _pthread_wqthread + 1088
15 libsystem_pthread.dylib 0x00000001812b9020 start_wqthread + 0
I access to the database from multiple threads. As the documentation says, I have a single instance of FMDatabaseQueue and I share it across all the threads of the app. I'm getting a SEGV_MAPERR crash at the method [FMDatabaseQueue inDatabase:]
This crash happens hardly ever, but I would like to resolve it.
Any ideas what is causing it?
Thank you very much.
Like your other question, this crash seems to be a part of your app code and not Crittercism SDK. If you still believe that this has been caused due to Crittercism, you can create a support ticket by sending an email to support#apteligent.com by mentioning the concerned App ID and the direct crash URL. Be noted that the email support is available for paid customers only.
I'm seeing the following crash report, but it's not reproducible. How would I go about debugging it? Is this an AFNetworking issue? I'm using version 2.4.1.
Crashed: com.apple.NSURLSession-work
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000000
Thread : Crashed: com.apple.NSURLSession-work
0 CoreFoundation 0x0000000184aad978 CFDictionaryGetValue + 56
1 Foundation 0x0000000185aa9300 _NSSetLongLongValueAndNotify + 72
2 Foundation 0x0000000185aa9300 _NSSetLongLongValueAndNotify + 72
3 CFNetwork 0x0000000184543468 -[__NSCFLocalSessionTask _task_onqueue_didFinish] + 472
4 CFNetwork 0x0000000184544b38 -[__NSCFLocalSessionTask connection:didFinishLoadingWithError:] + 40
5 CFNetwork 0x000000018458d030 __46-[__NSCFURLSessionConnection _task_sendFinish]_block_invoke + 136
6 libdispatch.dylib 0x0000000196a49994 _dispatch_call_block_and_release + 24
7 libdispatch.dylib 0x0000000196a49954 _dispatch_client_callout + 16
8 libdispatch.dylib 0x0000000196a540a4 _dispatch_queue_drain + 1448
9 libdispatch.dylib 0x0000000196a4ca5c _dispatch_queue_invoke + 132
10 libdispatch.dylib 0x0000000196a56318 _dispatch_root_queue_drain + 720
11 libdispatch.dylib 0x0000000196a57c4c _dispatch_worker_thread3 + 108
12 libsystem_pthread.dylib 0x0000000196c2922c _pthread_wqthread + 816
Yes, it's probably an AFNetworking bug (fixed in 2.5.0), in all likelihood. Specifically, this one:
https://github.com/AFNetworking/AFNetworking/issues/1477
If not, then it is probably something similar—a key-value observer trying to observe some aspect of a URL session task has been deallocated and didn't stop observing that task prior to being deallocated.
I got the same issue and I found it is because I was using Firebase SDK and I upgraded it to 7.0.0,(Although this issue is reported by many developers from > 6.32.1 to 7.0.0) So the firebasePerformance is causing this issue in the first place, which later caused a crash while downloading images using SDWebImage. More information about this issue is here:
firebase/firebase-ios-sdk#6734
Firebase recently fixed this and released a new version for FirebasePerformance (7.0.1) After upgrading to version 7.0.1, I wasn't able to reproduce the crash any longer.
So upgrading of FirebasePerformance SDK to 7.0.1 version worked for me.