How to debug this information in swift (SIGTRAP #0 )? - swift

My application crashed, and I don't know the problem..
0 klood 0x00000001000e4640 0x1000ac000 + 230976
1 PexKit 0x00000001003a17e8 0x100334000 + 448488
2 PexKit 0x00000001003a1414 0x100334000 + 447508
3 Foundation 0x0000000182f04540 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
4 Foundation 0x0000000182e56870 -[NSBlockOperation main] + 96
5 Foundation 0x0000000182e46e48 -[__NSOperationInternal _start:] + 604
6 Foundation 0x0000000182f06934 __NSOQSchedule_f + 224
7 libdispatch.dylib 0x0000000181f9547c _dispatch_client_callout + 16
8 libdispatch.dylib 0x0000000181f9ab84 _dispatch_main_queue_callback_4CF + 1844
9 CoreFoundation 0x0000000182500d50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
10 CoreFoundation 0x00000001824febb8 __CFRunLoopRun + 1628
11 CoreFoundation 0x0000000182428c50 CFRunLoopRunSpecific + 384
12 GraphicsServices 0x0000000183d10088 GSEventRunModal + 180
13 UIKit 0x0000000187712088 UIApplicationMain + 204
14 klood 0x0000000100162fb0 0x1000ac000 + 749488
15 libdyld.dylib 0x0000000181fc68b8 start + 4
I think the problem maybe is _dispatch_main_queue_callback_4CF, and I don't know how to fix it, thank you very much.

Start with the beginning, follow your code step by step with breakpoints. If you don't know where to start, place your breakpoint at the first viewDidLoad() and just follow from there.

Related

Swift 5 very random and hardly identifiable crashes

My crash log from firebase unfortunately doesnt really help me finding a solution to my issue.
Crashed: com.apple.main-thread
0 MyApp 0x94d30 PostsAPI.loadNewestPosts(ordering:start:limit:onSuccess:) + 4306505008 (<compiler-generated>:4306505008)
1 MyApp 0x5f8ec OverviewVC.loadNewestPosts(more:) + 4306286828 (<compiler-generated>:4306286828)
2 MyApp 0x6393c partial apply for closure #2 in closure #1 in OverviewVC.loadNewestPosts(more:) + 4306303292 (<compiler-generated>:4306303292)
3 MyApp 0x74a94 thunk for #escaping #callee_guaranteed () -> () + 4306373268 (<compiler-generated>:4306373268)
4 libdispatch.dylib 0x3a30 _dispatch_client_callout + 20
5 libdispatch.dylib 0x6eec _dispatch_continuation_pop + 500
6 libdispatch.dylib 0x1a13c _dispatch_source_invoke + 1596
7 libdispatch.dylib 0x11e9c _dispatch_main_queue_drain + 756
8 libdispatch.dylib 0x11b98 _dispatch_main_queue_callback_4CF + 44
9 CoreFoundation 0x51800 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
10 CoreFoundation 0xb704 __CFRunLoopRun + 2532
11 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600
12 GraphicsServices 0x1374 GSEventRunModal + 164
13 UIKitCore 0x514b58 -[UIApplication _run] + 1100
14 UIKitCore 0x296090 UIApplicationMain + 364
15 MyApp 0x9a28 main + 20 (AppDelegate.swift:20)
16 ??? 0x102a59da4 (Fehlt)
As my code obviously doesn't have so many lines as the compiler tells me where it crashes. Any help is greatly appreciated as I cannot provoke this crash and it only happens randomly on some devices...

AFNetworking and NSBlockOperation crash

Running an iPhone app using the latest version of AFNetworking, the most popular crash according to Crashlytics is involving NSBlockOperation. I am unsure whether AFNetworking is responsible or not. The log from Crashlytics:
Exception Type: EXC_BAD_ACCESS Code: KERN_INVALID_ADDRESS at 0x2985118298
5com.apple.NSURLConnectionLoader Crashed
0 libobjc.A.dylib objc_msgSend + 9
1 Foundation -[NSBlockOperation main] + 200
2 Foundation -[__NSOperationInternal start] + 840
3 Foundation -[_NSCFURLProtocolBridgeWithTrampoline processEventQ] + 344
4 Foundation -[_NSCFURLProtocolBridgeWithTrampoline pushEvent:from:] + 298
5 Foundation -[_NSCFURLProtocolBridge stop] + 88
6 Foundation _bridger + 64
7 CFNetwork __block_global_7 + 24
8 CFNetwork __block_global_8 + 12
9 CFNetwork ___performAsync_block_invoke_068 + 18
10 CoreFoundation CFArrayApplyFunction + 176
11 CFNetwork RunloopBlockContext::perform() + 74
12 CFNetwork MultiplexerSource::perform() + 188
13 ... CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
14 CoreFoundation __CFRunLoopDoSources0 + 212
15 CoreFoundation __CFRunLoopRun + 646
16 CoreFoundation CFRunLoopRunSpecific + 356
17 CoreFoundation CFRunLoopRunInMode + 104
18 Foundation +[NSURLConnection(Loader) _resourceLoadLoop:] + 308
19 Foundation __NSThread__main__ + 972
20 libsystem_c.dylib _pthread_start + 308
Let me know if you need more logs. Can anybody direct me in the direction to avoid this crash? Out of 2500 users 76 users has been affected.
Update Sept 17:
Seems like this guy is having the same problem:
iOS Blocks Async Callbacks Causing Crash after View Controller is deallocated.

Mysterious app crash after AppStore update

We have released an app to the AppStore and after an update it crashes after trying to login. We have been heavily relying on a CoreData database in it and we think it is the reason of the crash. Nevertheless I couldn't get any valuable info from the device, just a crash log that features some thread information. Here's how it looks:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xd0000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x32b3e5b0 objc_msgSend + 16
1 Foundation 0x337cbd18 -[NSError dealloc] + 56
2 libobjc.A.dylib 0x32b40484 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 164
3 CoreFoundation 0x31bc843c _CFAutoreleasePoolPop + 12
4 Foundation 0x337ccf76 -[NSAutoreleasePool drain] + 118
5 CoreData 0x32f6d4ae -[NSManagedObjectContext save:] + 1206
6 ourapp 0x0012fbf8 0xba000 + 482296
7 CoreData 0x32f70bbe developerSubmittedBlockToNSManagedObjectContextPerform + 86
8 CoreData 0x32f70cee -[NSManagedObjectContext performBlockAndWait:] + 90
9 ourapp 0x0012fb4c 0xba000 + 482124
10 ourapp 0x000c4e08 0xba000 + 44552
11 ourapp 0x000cced4 0xba000 + 77524
12 ourapp 0x000db50a 0xba000 + 136458
13 ourapp 0x0014c41a 0xba000 + 599066
14 Foundation 0x33893ef2 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 14
15 Foundation 0x337d39ec -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 196
16 Foundation 0x337d3908 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 56
17 CFNetwork 0x38da65dc ___delegate_didFinishLoading_block_invoke_0 + 24
18 CFNetwork 0x38da5cc8 ___withDelegateAsync_block_invoke_0 + 52
19 CFNetwork 0x38dce130 ___performAsync_block_invoke_068 + 16
20 CoreFoundation 0x31bcb74a CFArrayApplyFunction + 174
21 CFNetwork 0x38dce58e RunloopBlockContext::perform() + 70
22 CFNetwork 0x38d3215a MultiplexerSource::perform() + 186
23 CoreFoundation 0x31c5a680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
24 CoreFoundation 0x31c59f7a __CFRunLoopDoSources0 + 358
25 CoreFoundation 0x31c58cb2 __CFRunLoopRun + 642
26 CoreFoundation 0x31bcbeb8 CFRunLoopRunSpecific + 352
27 CoreFoundation 0x31bcbd44 CFRunLoopRunInMode + 100
28 GraphicsServices 0x399c92e6 GSEventRunModal + 70
29 UIKit 0x394872f4 UIApplicationMain + 1116
30 ourapp 0x000be76a 0xba000 + 18282
31 ourapp 0x000bb684 0xba000 + 5764
Are there any other chances I can get more info out of this situation? How can I plug it in to XCode and possibly trace the crash or it can only be done post-factum?
And most importantly, what do you think is causing the crash?
Our problem was connected with Core Data lightweight migration. We were using the "Magical Record" library for handling our Core Data fetches and updating it solved the problem.
Also, this blog post was quite useful.

good methods to debug iOS exception

i want to debug my exception at my app,i have read
Debugging -[NSCFDictionary setObject:forKey:]: attempt to insert nil value add so on,but these methods is happen at i am running my app,so i can use add an Exception breakpoint, click the Add (+) button at the bottom of the breakpoints list and click Add Exception Breakpoint ,and use gcc command line怂but my question is if user give me a crash report,the bug not easy happen,how to solve it ,for example:
Application received signal SIGSEGV
(null)
(
0 CoreFoundation 0x3120e2bb + 186
1 libobjc.A.dylib 0x38f2b97f objc_exception_throw + 30
2 CoreFoundation 0x3120e1c5 + 0
3 myshine 0x001f9f51 myshine + 1503057
4 libsystem_c.dylib 0x393a9e8b _sigtramp + 34
5 myshine 0x000ac985 myshine + 137605
6 myshine 0x000ac35d myshine + 136029
7 CoreFoundation 0x311ab7cf + 74
8 CoreFoundation 0x311b1623 + 74
9 CoreFoundation 0x311ab507 + 326
10 CFNetwork 0x30f0fa8b + 98
11 CFNetwork 0x30f0ec71 + 36
12 CFNetwork 0x30f11365 + 44
13 CFNetwork 0x30f110f9 + 88
14 CFNetwork 0x30f114ff + 34
15 CFNetwork 0x30ed0ce1 + 324
16 CFNetwork 0x30ed1661 + 156
17 CFNetwork 0x30f0ec71 + 36
18 CFNetwork 0x30f11365 + 44
19 CoreFoundation 0x311e3683 + 14
20 CoreFoundation 0x311e2ee9 + 212
21 CoreFoundation 0x311e1cb7 + 646
22 CoreFoundation 0x31154ebd CFRunLoopRunSpecific + 356
23 CoreFoundation 0x311b39bb CFRunLoopRun + 98
24 myshine 0x000b20ef myshine + 159983
25 Foundation 0x31b24e85 + 972
26 libsystem_c.dylib 0x39382311 + 308
27 libsystem_c.dylib 0x393821d8 thread_start + 8
)
and
*** -[__NSArrayM objectAtIndex:]: index 121 beyond bounds [0 .. 23]
(
0 CoreFoundation 0x311963ff + 186
1 libobjc.A.dylib 0x38e87963 objc_exception_throw + 30
2 CoreFoundation 0x310e1ef9 + 164
3 myshine 0x001720b1 myshine + 1372337
4 UIKit 0x33090087 + 70
5 UIKit 0x3309003b + 30
6 UIKit 0x33090015 + 44
7 UIKit 0x3308f8cb + 502
8 UIKit 0x3308fdb9 + 488
9 UIKit 0x32fb85f9 + 524
10 UIKit 0x32fa58e1 + 380
11 UIKit 0x32fa51ef + 6198
12 GraphicsServices 0x34cbc5f7 + 590
13 GraphicsServices 0x34cbc227 + 34
14 CoreFoundation 0x3116b3e7 + 34
15 CoreFoundation 0x3116b38b + 138
16 CoreFoundation 0x3116a20f + 1382
17 CoreFoundation 0x310dd23d CFRunLoopRunSpecific + 356
18 CoreFoundation 0x310dd0c9 CFRunLoopRunInMode + 104
19 GraphicsServices 0x34cbb33b GSEventRunModal + 74
20 UIKit 0x32ff92b9 UIApplicationMain + 1120
21 myshine 0x00026ec7 myshine + 16071
22 myshine 0x00025660 myshine + 9824
)
through i know NSArray beyond bounds,but my app have many many NSArray,and they are user report,can you give me some easy methods to find the location?
From your question what I understood is you want the method which has produced the crash in your app. May be this can help you Symbolicating iPhone App Crash Reports.

iphone - understanding crash logs

Im developing my app and yesterday while I was playing with it crashed. I wasnt debugging, so I thought I'd take a look at the crash log today.
But my surprise is that I can't see anything that can give me some info, here it is:
Thread 0 Crashed:
0 libobjc.A.dylib 0x33479464 objc_msgSend + 16
1 MapKit 0x31bffe28 -[MKMapView annotationContainer:viewForAnnotation:] + 36
2 MapKit 0x31bffaba -[MKAnnotationContainerView _addViewForAnnotation:] + 270
3 MapKit 0x31c25540 -[MKAnnotationContainerView addViewForManagedAnnotation:] + 8
4 MapKit 0x31c21df2 -[MKMapView(UserPositioningInternal) _runPositioningChange] + 1034
5 MapKit 0x31c20036 -[MKMapView(UserPositioningInternal) _startPositioningChange:] + 22
6 MapKit 0x31c23446 -[MKMapView(UserPositioningInternal) locationManagerUpdatedLocation:] + 578
7 CoreFoundation 0x33a5ebb8 -[NSObject(NSObject) performSelector:withObject:] + 16
8 CoreFoundation 0x33a83266 -[NSArray makeObjectsPerformSelector:withObject:] + 394
9 MapKit 0x31c1232a -[MKLocationManager _reportLocationStatus:] + 34
10 MapKit 0x31c13844 -[MKLocationManager _reportLocationSuccess] + 36
11 MapKit 0x31c134b8 -[MKLocationManager locationManager:didUpdateToLocation:fromLocation:] + 688
12 CoreLocation 0x34371410 -[CLLocationManager onClientEventLocation:] + 528
13 CoreLocation 0x3436f68e -[CLLocationManager onClientEvent:supportInfo:] + 98
14 CoreLocation 0x3436f7e6 OnClientEventInternal + 14
15 CoreLocation 0x3436b534 CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 60
16 CoreLocation 0x3436d3cc CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 196
17 CoreLocation 0x3436d512 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 286
18 CoreFoundation 0x33a813fe __CFMessagePortPerform + 242
19 CoreFoundation 0x33a556f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
20 CoreFoundation 0x33a556bc __CFRunLoopDoSource1 + 160
21 CoreFoundation 0x33a47f76 __CFRunLoopRun + 514
22 CoreFoundation 0x33a47c80 CFRunLoopRunSpecific + 224
23 CoreFoundation 0x33a47b88 CFRunLoopRunInMode + 52
24 GraphicsServices 0x33b0e4a4 GSEventRunModal + 108
25 GraphicsServices 0x33b0e550 GSEventRun + 56
26 UIKit 0x32099322 -[UIApplication _run] + 406
27 UIKit 0x32096e8c UIApplicationMain + 664
28 Palyque 0x0000280a main (main.m:14)
29 Palyque 0x00002794 start + 44
Hope you can help me with this, thanks.
Without the app still in memory I'm not sure there's much you can do. From experience I guess you messaged an object that has been dealloc'd. (Maybe the datasource object for your MKMapView?) I'd try running your app with zombies enabled to track it down.