iOS crash in CoreLocation - ios

I'm seeing this crash my iOS app after it's been running for 10 minutes:
Date/Time: 2012-02-22 15:26:41.415 -0800
OS Version: iPhone OS 5.0.1 (9A405)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x49980286
Crashed Thread: 6
The offending thread:
Thread 6 name: Dispatch queue: com.apple.locationd.registration.xpcq
Thread 6 Crashed:
0 libstdc++.6.dylib 0x33ed32f8 std::string::compare(std::string const&) const + 8
1 CoreLocation 0x3095ad54 std::_Rb_tree<std::string, std::pair<std::string const, void ( block_pointer)(CLConnectionMessage*)>, std::_Select1st<std::pair<std::string const, void ( block_pointer)(CLConnectionMessage*)> >, std::less<std::string>, std::allocator<std::pair<std::string const, void ( block_pointer)(CLConnectionMessage*)> > >::find(std::string const&) + 32
2 CoreLocation 0x30959964 CLConnection::handleMessage(CLConnectionMessage*) + 16
3 CoreLocation 0x3095a78c __setEventHandler_block_invoke_0 + 360
4 libxpc.dylib 0x37a428c2 __XPC_CONNECTION_EVENT_HANDLER_CALLOUT__ + 30
5 libxpc.dylib 0x37a3bd5c _xpc_connection_recv_message + 500
6 libxpc.dylib 0x37a3bb18 _xpc_connection_wakeup_recv + 160
7 libxpc.dylib 0x37a3b9b8 _xpc_connection_wakeup2 + 1264
8 libxpc.dylib 0x37a3b3f6 _xpc_connection_wakeup + 62
9 libdispatch.dylib 0x36d7821e _dispatch_source_invoke + 510
10 libdispatch.dylib 0x36d75b70 _dispatch_queue_invoke$VARIANT$up + 40
11 libdispatch.dylib 0x36d75caa _dispatch_queue_drain + 202
12 libdispatch.dylib 0x36d75b66 _dispatch_queue_invoke$VARIANT$up + 30
13 libdispatch.dylib 0x36d75caa _dispatch_queue_drain + 202
14 libdispatch.dylib 0x36d75b66 _dispatch_queue_invoke$VARIANT$up + 30
15 libdispatch.dylib 0x36d75caa _dispatch_queue_drain + 202
16 libdispatch.dylib 0x36d75b66 _dispatch_queue_invoke$VARIANT$up + 30
17 libdispatch.dylib 0x36d7676c _dispatch_worker_thread2 + 208
18 libsystem_c.dylib 0x32ee21c8 _pthread_wqthread + 288
19 libsystem_c.dylib 0x32ee209c start_wqthread + 0
The console doesn't give me any messages except to say that I have a crash. Any thoughts?

So after lots of digging I was able to repro the issue and find what was causing it. This seems to occur if you call -[CLLocationManager startUpdatingLocation] and -[CLLocationManager stopUpdatingLocation] in a tight loop.

I was having this trouble as well, but only on iOS 5.x (testing in Simulator, don't have the device.) It seemed to occur when I had more than one location manager instance, and both had the delegate set.

Related

Understanding Xcode Device Log Crashes

I am a relatively new developer and would like some assistance. My app does not crash when I have it hooked up via Xcode. However, when I try to run it again the next day (launching from my phone), it crashes when trying to open it. I am currently debugging the situation and am unsure how to proceed.
I'm having troubles with understanding how a device log crashes work. I was able to get to my device's crashes in Xcode via Window>Device and Simulators>View Device Logs>All Logs. I am able to understand that having an Exception type of "EXC_BREAKPOINT (SIGTRAP)" means that I force unwrap a nil value. I am unsure how through looking at the log (or any other method) that I can locate in my code where this is happening. How can I locate in all my files where this is causing a crash?
Date/Time: 2018-04-05 14:33:48.7121 -0500
Launch Time: 2018-04-05 14:33:47.8058 -0500
OS Version: iPhone OS 11.3 (15E216)
Baseband Version: 1.04.16
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000104177ff8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 1
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x0000000180d07e08 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000180d07c80 mach_msg + 72
2 CoreFoundation 0x000000018124ae40 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000181248908 __CFRunLoopRun + 1568
4 CoreFoundation 0x0000000181168da8 CFRunLoopRunSpecific + 552
5 GraphicsServices 0x000000018314b020 GSEventRunModal + 100
6 UIKit 0x000000018b14978c UIApplicationMain + 236
7 &me 0x0000000102cd00e4 0x102bac000 + 1196260
8 libdyld.dylib 0x0000000180bf9fc0 start + 4
Thread 1 name: Dispatch queue: NSOperationQueue 0x1d4224f80 (QOS: UNSPECIFIED)
Thread 1 Crashed:
0 libswiftCore.dylib 0x0000000104177ff8 0x103fd0000 + 1736696
1 libswiftCore.dylib 0x0000000104177ff8 0x103fd0000 + 1736696
2 libswiftCore.dylib 0x00000001040182b8 0x103fd0000 + 295608
3 &me 0x0000000102c9576c 0x102bac000 + 956268
4 &me 0x0000000102c95cbc 0x102bac000 + 957628
5 CFNetwork 0x0000000181831c1c __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 32
6 CFNetwork 0x000000018184a93c __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 152
7 Foundation 0x0000000181ccae88 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
8 Foundation 0x0000000181c0c8d0 -[NSBlockOperation main] + 72
9 Foundation 0x0000000181c0bcac -[__NSOperationInternal _start:] + 848
10 libdispatch.dylib 0x0000000180b94ae4 _dispatch_client_callout + 16
11 libdispatch.dylib 0x0000000180bd0b0c _dispatch_block_invoke_direct$VARIANT$armv81 + 216
12 libdispatch.dylib 0x0000000180b94ae4 _dispatch_client_callout + 16
13 libdispatch.dylib 0x0000000180bd0b0c _dispatch_block_invoke_direct$VARIANT$armv81 + 216
14 libdispatch.dylib 0x0000000180bd0a00 dispatch_block_perform$VARIANT$armv81 + 104
15 Foundation 0x0000000181ccc750 __NSOQSchedule_f + 376
16 libdispatch.dylib 0x0000000180b94ae4 _dispatch_client_callout + 16
17 libdispatch.dylib 0x0000000180bd17a8 _dispatch_continuation_pop$VARIANT$armv81 + 416
18 libdispatch.dylib 0x0000000180bd0180 _dispatch_async_redirect_invoke$VARIANT$armv81 + 596
19 libdispatch.dylib 0x0000000180bd63a4 _dispatch_root_queue_drain + 592
20 libdispatch.dylib 0x0000000180bd60f0 _dispatch_worker_thread3 + 112
21 libsystem_pthread.dylib 0x0000000180ec7fac _pthread_wqthread + 1176
22 libsystem_pthread.dylib 0x0000000180ec7b08 start_wqthread + 4
To understand the crash log you can go through the following apple documentation. This is the best explanation I found so far.
https://developer.apple.com/library/content/technotes/tn2151/_index.html

bug: ios app on ipad and ios8 & ios9 quits when loading googleMapsM4B (v. 1.10-2.2)

Issue has been reported only for iPads. The stacktrace shows:
Hardware Model: iPad4,1
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
OS Version: iOS 9.0 (13A344)
Report Version: 105
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Exception Note: SIMULATED (this is NOT a crash)
Highlighted by Thread: 3
Application Specific Information:
com.Tappsi.tappsiuser failed to scene-create after 19.55s (launch took 0.45s of total time limit 20.00s)
Elapsed total CPU time (seconds): 22.530 (user 22.530, system 0.000), 56% CPU
Elapsed application CPU time (seconds): 18.920, 47% CPU
Filtered syslog:
None found
Thread 3 name: Dispatch queue: com.apple.CoreLocation.ConnectionClient.0x14f16ec10.events
Thread 3:
0 libsystem_kernel.dylib 0x000000019aab8c84 semaphore_timedwait_trap + 8
1 libdispatch.dylib 0x000000019a996630 _dispatch_semaphore_wait_slow + 160
2 CoreLocation 0x0000000186046dc8 0x186044000 + 11720
3 CoreLocation 0x000000018604b83c 0x186044000 + 30780
4 CoreLocation 0x0000000186085f38 0x186044000 + 270136
5 CoreLocation 0x0000000186083b8c 0x186044000 + 261004
6 CoreLocation 0x0000000186083ac0 0x186044000 + 260800
7 CoreLocation 0x0000000186084d0c 0x186044000 + 265484
8 libxpc.dylib 0x000000019abcd30c _xpc_connection_call_event_handler + 68
9 libxpc.dylib 0x000000019abcb0b4 _xpc_connection_mach_event + 2132
10 libdispatch.dylib 0x000000019a98586c _dispatch_client_callout4 + 16
11 libdispatch.dylib 0x000000019a989b58 _dispatch_mach_msg_invoke + 656
12 libdispatch.dylib 0x000000019a991930 _dispatch_queue_drain + 1332
13 libdispatch.dylib 0x000000019a988c6c _dispatch_mach_invoke + 600
14 libdispatch.dylib 0x000000019a991930 _dispatch_queue_drain + 1332
15 libdispatch.dylib 0x000000019a989274 _dispatch_queue_invoke + 464
16 libdispatch.dylib 0x000000019a991930 _dispatch_queue_drain + 1332
17 libdispatch.dylib 0x000000019a989274 _dispatch_queue_invoke + 464
18 libdispatch.dylib 0x000000019a985770 _dispatch_client_callout + 16
19 libdispatch.dylib 0x000000019a993bb0 _dispatch_root_queue_drain + 2140
20 libdispatch.dylib 0x000000019a99334c _dispatch_worker_thread3 + 112
21 libsystem_pthread.dylib 0x000000019ab99478 _pthread_wqthread + 1092
22 libsystem_pthread.dylib 0x000000019ab99028 start_wqthread + 4
Thread 10 name: com.google.Maps.LabelingBehavior
Thread 10:
0 libsystem_kernel.dylib 0x000000019aab8c30 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000019aab8aac mach_msg + 72
2 CoreFoundation 0x0000000185878168 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000185875e6c __CFRunLoopRun + 1032
4 CoreFoundation 0x00000001857a4dc0 CFRunLoopRunSpecific + 384
5 Foundation 0x00000001867187ec -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308
6 Tappsi 0x0000000100577af8 -[GMSx_GTMSimpleWorkerThread main] + 604
7 Foundation 0x00000001867ff138 __NSThread__start__ + 1000
8 libsystem_pthread.dylib 0x000000019ab9bb3c _pthread_body + 156
9 libsystem_pthread.dylib 0x000000019ab9baa0 _pthread_body + 0
10 libsystem_pthread.dylib 0x000000019ab99030 thread_start + 4
And seems to be a problem similar to:
https://code.google.com/p/gmaps-api-issues/issues/detail?id=6484
Although it happens always when loading the viewController that implements GMSMapViewDelegate. Hangs between the ViewWillAppear method and the ViewDidAppear method.
Why does it work on iPhone but not on iPad?

Unity iOS 64 bit build crash at com.apple.IOAccelerator.BlockFences, Exception Subtype: KERN_INVALID_ADDRESS

I am using Unity 4.6.6f2 and made il2cpp build to support 64 bit requirement from apple. I am having strange random crash and in device crash logs, I see these crash reports. It is happening on multiple devices and all of them have this in common:
Here's the logs:
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-06-18 12:06:11.292 +0400
Launch Time: 2015-06-18 11:50:59.940 +0400
OS Version: iOS 8.1 (12B410)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000000000029c
Triggered by Thread: 36
Thread 36 name: Dispatch queue: com.apple.IOAccelerator.BlockFences
Thread 36 Crashed:
0 libobjc.A.dylib 0x0000000194b739f4 objc_disposeClassPair + 192
1 libobjc.A.dylib 0x0000000194b739bc objc_disposeClassPair + 136
2 libsystem_blocks.dylib 0x000000019520190c _Block_release + 252
3 IOAccelerator 0x000000018d68aca4 ioAccelCommandQueueBlockFenceCallback + 60
4 IOKit 0x00000001851c58cc IODispatchCalloutFromCFMessage + 372
5 IOKit 0x00000001851c596c _IODispatchCalloutWithDispatch + 36
6 libdispatch.dylib 0x00000001951b2a2c dispatch_mig_server + 432
7 libdispatch.dylib 0x00000001951ad368 _dispatch_client_callout + 12
8 libdispatch.dylib 0x00000001951c20c4 _dispatch_source_latch_and_call + 788
9 libdispatch.dylib 0x00000001951af4d0 _dispatch_source_invoke + 284
10 libdispatch.dylib 0x00000001951b72a0 _dispatch_queue_drain + 672
11 libdispatch.dylib 0x00000001951b0470 _dispatch_queue_invoke + 128
12 libdispatch.dylib 0x00000001951b9220 _dispatch_root_queue_drain + 660
13 libdispatch.dylib 0x00000001951ba758 _dispatch_worker_thread3 + 104
14 libsystem_pthread.dylib 0x00000001953892e0 _pthread_wqthread + 812
15 libsystem_pthread.dylib 0x0000000195388fa4 start_wqthread + 0

Thread : Crashed: com.apple.NSURLSession-work

With the release of iOS 8 we've started getting several types of crashes that we've never seen before. Wondering if anyone else has seen this or has any suggestions.
Several of them look similar to this:
Thread : Crashed: com.apple.NSURLSession-work
0 libsystem_kernel.dylib 0x2fd3adfc __pthread_kill + 8
1 libsystem_pthread.dylib 0x2fdb8d37 pthread_kill + 62
2 libsystem_c.dylib 0x2fcda909 abort + 76
3 libsystem_malloc.dylib 0x2fd6b3af szone_error + 334
4 libsystem_malloc.dylib 0x2fd6b637 free_small_botch + 66
5 CFNetwork 0x21a63935 HTTPMessage::ensureParserFinished() + 72
6 CFNetwork 0x21a7aad3 HTTPMessage::copyHeaderFieldValue(__CFString const*) + 18
7 CFNetwork 0x21b43e87 HTTPSniffing::checkRequestAndUpdateResponseForSniffingPurposes(_CFURLRequest const*, _CFURLResponse*) + 130
8 CFNetwork 0x21b15ddd URLConnectionClient::_loaderClientEvent_DidReceiveResponse(_CFURLResponse*) + 340
9 CFNetwork 0x21b1b7d9 ___ZN19URLConnectionLoader26protocolDidReceiveResponseEP14_CFURLResponse_block_invoke + 24
10 CFNetwork 0x21ac9e03 ___ZN20ClassicURLConnection21withLoaderClientAsyncEU13block_pointerFvP21LoaderClientInterfaceE_block_invoke + 14
11 CFNetwork 0x21b14ca9 ___ZNK25URLConnectionInstanceData18withWorkQueueAsyncEU13block_pointerFvvE_block_invoke + 12
12 libdispatch.dylib 0x2fc548cb _dispatch_call_block_and_release + 10
13 libdispatch.dylib 0x2fc5c651 _dispatch_queue_drain + 952
14 libdispatch.dylib 0x2fc5709d _dispatch_queue_invoke + 84
15 libdispatch.dylib 0x2fc5dba1 _dispatch_root_queue_drain + 320
16 libdispatch.dylib 0x2fc5ecd7 _dispatch_worker_thread3 + 94
17 libsystem_pthread.dylib 0x2fdb5e31 _pthread_wqthread + 668
Thanks,
Dan
This is a bug in Apple's code and there is nothing you can do about it, other than wait for an iOS update (or you may want to avoid using the NSURLSession APIs and invoking -[NSURLHTTPResponse allHeaderFields]). But don't hold your horses, it's been there since at least iOS 7.0 and has been reported multiple times (I have done it and my ticket got closed as dupe) and is still not fixed on iOS 8.0.2.
Try updating to the latest AFNetworking 2.5.3.

Crash at [ALAssetRepresentation metadata]

My app uses ALAssetsLibrary to get all photos from the user's device and upload them to our cloud server. I notice that from time to time users get a crash at [ALAssetRepresentation metadata] (see crash log below). I cannot get the same problem at my device with any photos. Is it a problem with a system photo library? How can I prevent this crashing?
Thank you
Date/Time: 2014-08-16 10:15:39.865 +0300
OS Version: iOS 7.1.1 (11D201)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000
Triggered by Thread: 9
....
Thread 9 Crashed:
0 CoreFoundation 0x2eeda5c2 CFDataGetBytePtr + 6
1 PhotoLibraryServices 0x358d7128 __46-[PLManagedAsset adjustmentsXMPRepresentation]_block_invoke + 224
2 CoreData 0x2ed839ca developerSubmittedBlockToNSManagedObjectContextPerform + 86
3 CoreData 0x2ed83b0e -[NSManagedObjectContext performBlockAndWait:] + 110
4 PhotoLibraryServices 0x358d6fda -[PLManagedAsset adjustmentsXMPRepresentation] + 222
5 AssetsLibrary 0x2e6f9498 __33-[ALAssetRepresentation metadata]_block_invoke + 20
6 AssetsLibrary 0x2e700862 __53-[ALAssetRepresentationPrivate _performBlockAndWait:]_block_invoke + 66
7 CoreData 0x2ed839ca developerSubmittedBlockToNSManagedObjectContextPerform + 86
8 libdispatch.dylib 0x39c2bd3c _dispatch_client_callout + 20
9 libdispatch.dylib 0x39c306be _dispatch_barrier_sync_f_invoke + 22
10 CoreData 0x2ed83b06 -[NSManagedObjectContext performBlockAndWait:] + 102
11 AssetsLibrary 0x2e6fc36a -[ALAssetsLibrary _performBlockAndWait:] + 130
12 AssetsLibrary 0x2e700624 -[ALAssetRepresentationPrivate _performBlockAndWait:] + 172
13 AssetsLibrary 0x2e6f93ec -[ALAssetRepresentation metadata] + 460
....
17 AssetsLibrary 0x2e6fe70c __56-[ALAssetsLibrary assetForURL:resultBlock:failureBlock:]_block_invoke_2 + 248
18 libdispatch.dylib 0x39c2bd50 _dispatch_call_block_and_release + 8
19 libdispatch.dylib 0x39c31684 _dispatch_root_queue_drain + 224
20 libdispatch.dylib 0x39c318d8 _dispatch_worker_thread2 + 52
21 libsystem_pthread.dylib 0x39d5cc14 _pthread_wqthread + 296
22 libsystem_pthread.dylib 0x39d5cad8 start_wqthread + 4

Resources