iOS - Objective-C: application crash on iOS 10 after libraries upgrade - ios

I have an older Objective-C application that I upgraded recently in order to add new functionalities. I'm using now AFNetworking version 4.0. All is working now even in the newest version of iOS except on iOS 10. When I run it on the simulator, the application crash immediately in the splashSreen. From the logs I know that it's in relation with NSURLSession but can't figure out how to solve it. I've found similar issues but there solutions are not up-to-date.
This is what I have in the thread stack when the crash happened
And this is the crash description from the console log with some previous Firebase calls:
2020-11-19 18:48:11.257 myApp[63563:2715840] Appdelegate, applicationDidBecomeActive
Nov 19 18:48:11 myApp[63563] <Warning>: 6.34.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
Nov 19 18:48:11 myApp[63563] <Notice>: 6.34.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
Nov 19 18:48:11 myApp[63563] <Notice>: 6.34.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
2020-11-19 18:48:11.645 myApp[63563:2715921] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fa48d318df0 of class __NSCFLocalDataTask was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x600000031ce0> ( <NSKeyValueObservance 0x60000024a200: Observer: 0x6080000f5980, Key path: state, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x608000253ad0> )'
*** First throw call stack: (
1 libobjc.A.dylib 0x0000000112558141 objc_exception_throw + 48
2 CoreFoundation 0x0000000112b5c625 +[NSException raise:format:] + 197
3 Foundation 0x000000010fb52b53 NSKVODeallocate + 294
4 libobjc.A.dylib 0x000000011256cb8e _ZN11objc_object17sidetable_releaseEb + 202
5 libsystem_blocks.dylib 0x0000000113ff799d _Block_release + 111
6 libdispatch.dylib 0x0000000113f6405c _dispatch_client_callout + 8
7 libdispatch.dylib 0x0000000113f40c6e _dispatch_continuation_pop + 1020
8 libdispatch.dylib 0x0000000113f4e5db _dispatch_source_invoke + 1401
9 libdispatch.dylib 0x0000000113f42c47 _dispatch_queue_serial_drain + 981
10 libdispatch.dylib 0x0000000113f43669 _dispatch_queue_invoke + 1084
11 libdispatch.dylib 0x0000000113f45ec4 _dispatch_root_queue_drain + 634
12 libdispatch.dylib 0x0000000113f45bef _dispatch_worker_thread3 + 123
13 libsystem_pthread.dylib 0x000000011430d6d5 _pthread_wqthread + 220
14 libsystem_pthread.dylib 0x000000011430d57b start_wqthread + 15 ) libc++abi.dylib: terminating with uncaught exception of type NSException

Related

Firebase email link authentication crashing our Flutter app on iOS

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

AVAudioEngineImpl::IOUnitConfigurationChanged() Crash

I use AudioEngine.
In crash reports I see some random EXC_BREAKPOINT crashes with this stacktrace
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001896df0e4
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [12467]
Triggered by Thread: 15
Thread 15 Crashed:
0 libdispatch.dylib 0x00000001896df0e4 __DISPATCH_WAIT_FOR_QUEUE__ + 448 (queue.c:1619)
1 libdispatch.dylib 0x00000001896dec74 _dispatch_sync_f_slow + 140 (queue.c:1732)
2 libdispatch.dylib 0x00000001896dec74 _dispatch_sync_f_slow + 140 (queue.c:1732)
3 AVFAudio 0x00000001965b11a8 -[AVAudioEngine dealloc] + 308 (AVAudioEngine.mm:406)
4 Foundation 0x0000000189ce52ac -[NSConcreteNotification dealloc] + 68 (NSNotification.m:206)
5 AVFAudio 0x00000001965b7158 invocation function for block in AVAudioEngineImpl::IOUnitConfigurationChanged() + 292 (AVAudioEngine.mm:1215)
6 libdispatch.dylib 0x00000001896de998 _dispatch_block_async_invoke2 + 104 (queue.c:525)
7 libdispatch.dylib 0x00000001896fb184 _dispatch_client_callout + 16 (object.m:495)
8 libdispatch.dylib 0x00000001896d4e8c _dispatch_continuation_pop$VARIANT$armv81 + 404 (inline_internal.h:2484)
9 libdispatch.dylib 0x00000001896e502c _dispatch_source_invoke$VARIANT$armv81 + 1232 (source.c:568)
10 libdispatch.dylib 0x00000001896d85e0 _dispatch_lane_serial_drain$VARIANT$armv81 + 260 (inline_internal.h:2525)
11 libdispatch.dylib 0x00000001896d9128 _dispatch_lane_invoke$VARIANT$armv81 + 400 (queue.c:3863)
12 libdispatch.dylib 0x00000001896e243c _dispatch_workloop_worker_thread + 576 (queue.c:6445)
13 libsystem_pthread.dylib 0x000000018974ab88 _pthread_wqthread + 276 (pthread.c:2351)
14 libsystem_pthread.dylib 0x000000018974d760 start_wqthread + 8
I can't reproduce this crash and stacktrace doesn't point to my code. Does anyone know what is cause of this crash, how this can be fixed and if it's even possible to fix?
Thanks
According to the apple documentation of AVAudioEngineConfigurationChange,
You must not release the engine during handling this notification.
Note The engine must not be deallocated from within the client's
notification handler. Callback happens on an internal dispatch queue
and can deadlock while trying to teardown the engine synchronously.
Though you didn't release at that time, It can be caused.
AVAudioEngine in iOS 11 or 12 can be stucked to notify before, then you release engine later.
There's workaround. You have to re-use the audio engine rather than re-create.

Crash on NotificationCenter addObserver call

I'm new to this project and Firebase has been added only recently, so I've some issue to figure out the reason of a crash (that I can't reproduce locally).
It's a EXC_BAD_ACCESS KERN_INVALID_ADDRESS on dispatch_call_block_and_release.
Therefore it should be a memory issue, trying to access to an object that has been already deallocated.
The last traced line is an addObserver call of Notification Center, and then the call trace continue with several calls but not showing an exact line of code. Since I don't see anything wrong with that observer, I'm wondering: is this line significant? Or it could be that the app is crashing on a different thread so that the call trace is irrelevant?
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000008
Crashed: com.apple.main-thread
0 MyPod 0x103dafb18 (Missing)
1 MyPod 0x103daf564 (Missing)
2 MyPod 0x103daf9fc (Missing)
3 MyApp 0x103b12ffc (Missing)
4 MyPod 0x103daf268 (Missing)
5 MyPod 0x103dae844 (Missing)
6 MyPod 0x103daef64 (Missing)
7 MyPodClient 0x103d40fd0 (Missing)
8 MyPodClient 0x103d3dcb8 (Missing)
9 libdispatch.dylib 0x1a9e38610 _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x1a9e39184 _dispatch_client_callout + 16
11 libdispatch.dylib 0x1a9deb190 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1044
12 CoreFoundation 0x1aa0ea5e4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
13 CoreFoundation 0x1aa0e55d8 __CFRunLoopRun + 2004
14 CoreFoundation 0x1aa0e4adc CFRunLoopRunSpecific + 464
15 GraphicsServices 0x1b406a328 GSEventRunModal + 104
16 UIKitCore 0x1ae1dfae0 UIApplicationMain + 1936
17 MyApp 0x102e0bce0 main + 21 (PlayerPlugin.swift:21) //-> This is the line in which a func is called, and inside this func observers are added.
thanks
ps. I don't know if this helps, but for some crash reports (but not all of them), I get in the KEYS section this line:
crash_info_entry_0
CoreUI: deallocating _CUIInternalLinkRendition 7113 /private/var/containers/Bundle/Application/A6721767-C6DD-43AB-B2E0-094D4CBD12D6/MyApp.app/Assets.car
Is this related to assets? However it looks more like a consequence of the crash, rather than a cause.

Generate Keychain IBM Mobile First V 7.1

I am using IBM Mobile First V 7.1 on an iOS app, the problem is after my app is submitted to the store, Fabric starts to send me weird exception:
Fatal Exception: Unable to generate key pair. Keychain returned the
following status: -25308
and every time I check Crashlytics I see a different trace stack of the exception, and the below is one of the exception that I got:
Fatal Exception: Unable to generate key pair.
0 CoreFoundation 0x18db1d1b8 __exceptionPreprocess
1 libobjc.A.dylib 0x18c55455c objc_exception_throw
2 CoreFoundation 0x18db1d100 -[NSException initWithCoder:]
3 RTA 0x1012ba4a0 +[WLCertManager generateKeyPair:withPublicKeyLabel:withKeySize:]
4 RTA 0x1012be730 +[WLCertManager signJWSPartsWithPayload:withPrivateKeyLabel:withPublicKeyLabel:withKeySize:]
5 RTA 0x10129ffcc -[WLAuthorizationManager buildJWSPartsWithClientId:]
6 RTA 0x10128607c __71-[WLRequest addClientInstanceIdHeaderWithRequest:withCompetionHandler:]_block_invoke
7 RTA 0x10129b4ec -[WLAuthorizationManager clientInstanceIdWithCompletionHandler:]
8 RTA 0x101285f2c -[WLRequest addClientInstanceIdHeaderWithRequest:withCompetionHandler:]
9 RTA 0x101284f40 -[WLRequest sendRequest:path:withOptions:]
10 RTA 0x10128685c -[WLRequest makeRequest:withOptions:withCallback:]
11 RTA 0x1012862f4 -[WLRequest makeRequest:withOptions:]
12 RTA 0x1012c36e8 -[WLClient invokeProcedure:withDelegate:options:]
13 RTA 0x1002e8d60 specialized FavouritesModel.getFavouritesList(FavouritesRequestDelegate?) -> () (FavouritesModel.swift)
14 RTA 0x1002e8484 FavouritesModel.getFavouritesList(FavouritesRequestDelegate?) -> () (FavouritesModel.swift:21)
15 RTA 0x10037508c MainDashboardViewController.pullToRefreshAction() -> () (MainDashboardViewController.swift:1793)
16 RTA 0x100389dc8 partial apply for MainDashboardViewController.(upperViewAnimation() -> ()).(closure #2).(closure #4) (MainDashboardViewController.swift:614)
17 Foundation 0x18e61a46c __NSFireDelayedPerform
18 CoreFoundation 0x18dacb1d8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
19 CoreFoundation 0x18dacaeec __CFRunLoopDoTimer
20 CoreFoundation 0x18daca7a8 __CFRunLoopDoTimers
21 CoreFoundation 0x18dac83a4 __CFRunLoopRun
22 CoreFoundation 0x18d9f62b8 CFRunLoopRunSpecific
23 GraphicsServices 0x18f4aa198 GSEventRunModal
24 UIKit 0x193a3d7fc -[UIApplication _run]
25 UIKit 0x193a38534 UIApplicationMain
26 RTA 0x100913fe0 main (AppDelegate.swift:35)
27 libdispatch.dylib 0x18c9d95b8 (Missing)
After some investigation and searching I found some recommendation to enable Keychain Sharing and the below screenshot is my app entitlement:
Please any advise how I can solve this problem or is there any missing configuration should be applied
Fatal Exception: Unable to generate key pair. Keychain returned the
following status: -25308
The above error occurs when app tries to generate key pair while phone is locked or while app is running during background mode. It seems to be your app is doing MFP requests while app is background or phone is locked.
Currently Mobilefirst iOS 7.x Client SDK's do not support MFP requests running in the background. You can use non-MFP API's if you are accessing unsecured resources.

Google Map Integration iOS 1.9.0 issue

Please provide solution on below error for google map iOS integration, Which i am facing from last two days but not getting any solution on this.
Find the below log for reference
2014-11-27 11:38:09.230 MapPin[2279:41725] CoreData: warning: Unable to load class named 'GMSCachedTile' for entity 'GMSCachedTile'. Class not found, using default NSManagedObject instead.
2014-11-27 11:38:09.231 MapPin[2279:41730] CoreData: warning: Unable to load class named 'GMSCachedObject' for entity 'GMSCachedObject'. Class not found, using default NSManagedObject instead.
2014-11-27 11:38:09.233 MapPin[2279:41725] -[NSManagedObject tileCoords]: unrecognized selector sent to instance 0x7a174ac0
2014-11-27 11:38:09.235 MapPin[2279:41725] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObject tileCoords]: unrecognized selector sent to instance 0x7a174ac0'
* First throw call stack:
(
0 CoreFoundation 0x03466946 exceptionPreprocess + 182
1 libobjc.A.dylib 0x030efa97 objc_exception_throw + 44
2 CoreFoundation 0x0346e5c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x033b73e7 ___forwarding_ + 1047
4 CoreFoundation 0x033b6fae _CF_forwarding_prep_0 + 14
5 MapPin 0x0011e892 __47-[GMSTileDataCache startWithCompletionHandler:]_block_invoke57 + 761
6 MapPin 0x00123bc4 -[GMSTileDataCache fetchTilesImmediateWithPredicate:sortDescriptor:completionHandler:] + 389
7 MapPin 0x0011e44c __47-[GMSTileDataCache startWithCompletionHandler:]_block_invoke + 474
8 libdispatch.dylib 0x0391e30a _dispatch_call_block_and_release + 15
9 libdispatch.dylib 0x0393ee2f _dispatch_client_callout + 14
10 libdispatch.dylib 0x03924afc _dispatch_queue_drain + 1475
11 libdispatch.dylib 0x039243c3 _dispatch_queue_invoke + 212
12 libdispatch.dylib 0x03927067 _dispatch_root_queue_drain + 466
13 libdispatch.dylib 0x0392884a _dispatch_worker_thread3 + 115
14 libsystem_pthread.dylib 0x03c9a296 _pthread_wqthread + 724
15 libsystem_pthread.dylib 0x03c97eea start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException
If you're following this tutorial (http://www.raywenderlich.com/81103/introduction-google-maps-ios-sdk-swift) but trying to implement this in your existing project, you probably skipped over the step to add -ObjC to the Other Linker Flags under the Build Settings for the Project.
I got exactly the same error. I had to remove all libs and re-add all the following libs. Then it just worked. Still don't know the exact thing fixed my issue. Just wanted to share what I did. If you know what exactly fixed your issue, I would love to know.
(excerpted from google map sdk site):
AVFoundation.framework
CoreData.framework
CoreLocation.framework
CoreText.framework
GLKit.framework
ImageIO.framework
libc++.dylib
libicucore.dylib
libz.dylib
OpenGLES.framework
QuartzCore.framework
SystemConfiguration.framework

Resources