Since iOS8 went live the other day, I've started to get lots of crash reports to do with address book / contact functionality. It's one of those annoying ones where the stack trace gives no clues about where in my code the problem originates. I've tried reproducing this in the iOS8 simulator by using the most obviously related functionality, but so far without joy (I don't own any devices running iOS8 yet).
The actual error is: Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000010
Here's the stack trace:
0 libobjc.A.dylib objc_msgSend + 16 respondsToSelector:
1 AddressBookUI -[ABMembersViewController membersController:shouldAllowSelectingPersonWithRecordID:] + 100
2 AddressBookUI -[ABMembersFilteredDataSource tableView:cellForRowAtIndexPath:] + 488
3 UIKit -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 544
4 UIKit -[UITableView _updateVisibleCellsNow:isRecursive:] + 2360
5 UIKit -[UITableView layoutSubviews] + 172
6 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 572
7 QuartzCore -[CALayer layoutSublayers] + 168
8 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) + 320
9 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
10 QuartzCore CA::Context::commit_transaction(CA::Transaction*) + 276
11 QuartzCore CA::Transaction::commit() + 436
12 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
13 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
18 UIKit UIApplicationMain + 1488
19 Prayer Partner main.m line 14 main
20 libdyld.dylib start + 4
I thought I'd post it here in case anybody has had any similar errors.
Related
While checking the issues reported by Crashlytics, it seems that I have a EXC_BREAKPOINT error for the following line:
self.caloriesFor100 = Int((cartFood.nbCalories.floatValue / 100) * cartFood.quantite.floatValue)
caloriesFor100 is a Int.
cartFood.nbCalories is an NSNumber which is supposed to have float values.
cartFood.quantite is also an NSNumber which is supposed to have float values.
I did not succeed to reproduce the issue. What could possibly cause an EXC_BREAKPOINT in this code?
Full stack trace:
Crashed: com.apple.main-thread
0 LSDP 0x10269ccbc specialized CartFoodModelinit(_:) (CartFoodModel.swift:88)
1 LSDP 0x10268a570 specialized CartFoodCell.cartFoodObjc (CartFoodModel.swift)
2 LSDP 0x102689600 #objc CartFoodCell.cartFoodObjc (<compiler-generated>)
3 LSDP 0x102664c7c -[PanierDuJourViewController tableView:cellForRowAtIndexPath:] (PanierDuJourViewController.m:156)
4 UIKit 0x18bf10148 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668
5 UIKit 0x18bf0fe00 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
6 UIKit 0x18bf0eb1c -[UITableView _updateVisibleCellsNow:isRecursive:] + 2280
7 UIKit 0x18bf0a668 -[UITableView layoutSubviews] + 140
8 UIKit 0x18be47770 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1420
9 QuartzCore 0x1863e925c -[CALayer layoutSublayers] + 184
10 QuartzCore 0x1863ed3ec CA::Layer::layout_if_needed(CA::Transaction*) + 324
11 QuartzCore 0x186359aa0 CA::Context::commit_transaction(CA::Transaction*) + 320
12 QuartzCore 0x1863815d0 CA::Transaction::commit() + 580
13 UIKit 0x18c22054c _UIApplicationFlushRunLoopCATransactionIfTooLate + 172
14 UIKit 0x18c7fd4c0 __handleEventQueueInternal + 5520
15 UIKit 0x18c7f6258 __handleHIDEventFetcherDrain + 152
16 CoreFoundation 0x18221b404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
17 CoreFoundation 0x18221ac2c __CFRunLoopDoSources0 + 276
18 CoreFoundation 0x18221879c __CFRunLoopRun + 1204
19 CoreFoundation 0x182138da8 CFRunLoopRunSpecific + 552
20 GraphicsServices 0x18411b020 GSEventRunModal + 100
21 UIKit 0x18c11978c UIApplicationMain + 236
22 LSDP 0x1025fce28 main (main.m:16)
23 libdyld.dylib 0x181bc9fc0 start + 4
You may catch this exception in case if NSNumber property will be nil. So maybe it is better to change nbCalories to has an option value.
I found a similar problem and its solution here.
Since your app crashes at tableView:cellForRowAtIndexPath:, it might be that the cell should display an entry of your table (CartFoodCell.cartFoodObjc) that no longer exists.
But without more code, this is just a guess. Please double check it in your code.
Does anynone know how to fix this issue? There are so many crashes posted to Fabric, which only appeared on iOS 11. Fabric gives a tip:
This crash has non-main threads that appear to use UIKit classes or functions. Generally speaking, it is only safe to use UIKit from the main thread. Calling into UIKit from background threads can cause unpredictable behavior (like crashes!). Please double check that all of your code (that is not on the main thread) has been explicitly marked as safe to use in the background by Apple.
Below is the crash session:
Crashed: WebThread
0 libobjc.A.dylib 0x1845041a0 objc_retain + 16
1 UIKit 0x18e850a10 -[UIView(Hierarchy) subviews] + 76
2 UIKit 0x18eb4416c -[UIView(CALayerDelegate) _wantsReapplicationOfAutoLayoutWithLayoutDirtyOnEntry:] + 72
3 UIKit 0x18e856e60 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1348
4 QuartzCore 0x1892e3948 -[CALayer layoutSublayers] + 184
5 QuartzCore 0x1892e7ad0 CA::Layer::layout_if_needed(CA::Transaction*) + 332
6 QuartzCore 0x18925431c CA::Context::commit_transaction(CA::Transaction*) + 336
7 QuartzCore 0x18927bb40 CA::Transaction::commit() + 540
8 QuartzCore 0x18927c980 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
9 CoreFoundation 0x185246cdc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
10 CoreFoundation 0x185244694 __CFRunLoopDoObservers + 412
11 CoreFoundation 0x185164c78 CFRunLoopRunSpecific + 468
12 WebCore 0x18d0d984c RunWebThread(void*) + 560
13 libsystem_pthread.dylib 0x184ec82b4 _pthread_body + 308
14 libsystem_pthread.dylib 0x184ec8180 _pthread_body + 310
15 libsystem_pthread.dylib 0x184ec6b74 thread_start + 4
My app keeps crashing in 2 different places in any version that is lower than iOS 11.
One of the crashes is an EXC_BREAKPOINT that breaks on the appDelegate class defining line - class AppDelegate: UIResponder, UIApplicationDelegate {}
While the other crashes with EXC_BREAKPOINT on a simple segmentedControl?.removeAllSegments() (and yes I checked if the segmentedControl is empty; its not).
Whats interesting is that I never had this issue so much as 2/3 weeks ago, and I know for a fact that I changed no line of code from those 2 places.
The debugger just says this : "-[UILayoutGuide nsli_superitem]: message sent to deallocated instance 0x600000386db0"
Here is the stack trace:
0 0x000000010a79c92e _T09 30SegmentedControlViewControllerC05setupcD0yyF + 126
1 0x000000010a79c6df _T0930SegmentedControlViewControllerC05setupE0yyF + 511
2 0x000000010a5dba30 _T0929MasterStockInfoViewControllerC11viewDidLoadyyF + 624
3 0x000000010a5dbb04 _T0929MasterStockInfoViewControllerC11viewDidLoadyyFTo + 36
4 UIKit 0x000000010bec101a -[UIViewController loadViewIfRequired] + 1235
5 UIKit 0x000000010bec73a6 -[UIViewController viewWillAppear:] + 118
6 UIKit 0x000000010bef13c8 -[UINavigationController _startCustomTransition:] + 1305
7 UIKit 0x000000010bf01967 -[UINavigationController _startDeferredTransitionIfNeeded:] + 687
8 UIKit 0x000000010bf02b41 -[UINavigationController __viewWillLayoutSubviews] + 58
9 UIKit 0x000000010c0f460c -[UILayoutContainerView layoutSubviews] + 231
10 UIKit 0x000000010bde155b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268
11 QuartzCore 0x000000010ec60904 -[CALayer layoutSublayers] + 146
12 QuartzCore 0x000000010ec54526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370
13 QuartzCore 0x000000010ec543a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
14 QuartzCore 0x000000010ebe3e92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
15 QuartzCore 0x000000010ec10130 _ZN2CA11Transaction6commitEv + 468
16 QuartzCore 0x000000010ec10b37 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 115
17 CoreFoundation 0x000000010e00a717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
18 CoreFoundation 0x000000010e00a687 __CFRunLoopDoObservers + 391
19 CoreFoundation 0x000000010dfef720 __CFRunLoopRun + 1200
20 CoreFoundation 0x000000010dfef016 CFRunLoopRunSpecific + 406
21 GraphicsServices 0x00000001117bba24 GSEventRunModal + 62
22 UIKit 0x000000010bd1e134 UIApplicationMain + 159
23 0x000000010a7c2257 main + 55
24 libdyld.dylib 0x000000010f6bd65d start + 1
Any information on this would be helpful, currently exploring all options. If you need more information on this, post a comment and I will get back to you instantly.
Thanks
Stupid, but I was finally able to figure it out.
I found that in my Interface Builder Document in storyboard, my deployment target was set at 11.0 for the pages I was trying to load.
I hope this helps someone :)
I am getting below crash logs across all iOS versions. However, I am not able to figure out the exact cause of this. Is it something to do with accessing a de-allocated object? If yes, is there a way to replicate the scenario since I am not able to.
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x180771b90 objc_msgSend + 16
1 CoreGraphics 0x182574568 CGColorRetain + 28
2 CoreGraphics 0x182609088 CGGStateSetStrokeColor + 64
3 UIKit 0x186893698 -[UIKBHandwritingStrokeView drawRect:] + 692
4 UIKit 0x1862e2678 -[UIView(CALayerDelegate) drawLayer:inContext:] + 368
5 QuartzCore 0x183c16228 -[CALayer drawInContext:] + 260
6 QuartzCore 0x183c008ac CABackingStoreUpdate_ + 2432
7 QuartzCore 0x183d18360 ___ZN2CA5Layer8display_Ev_block_invoke + 52
8 QuartzCore 0x183bffa88 CA::Layer::display_() + 1368
9 QuartzCore 0x183be17a8 CA::Layer::display_if_needed(CA::Transaction*) + 228
10 QuartzCore 0x183be1494 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 44
11 QuartzCore 0x183be0ab8 CA::Context::commit_transaction(CA::Transaction*) + 252
12 QuartzCore 0x183be0818 CA::Transaction::commit() + 500
13 UIKit 0x186256ff4 _UIApplicationHandleEventQueue + 4980
14 CoreFoundation 0x1810b109c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x1810b0b30 __CFRunLoopDoSources0 + 540
16 CoreFoundation 0x1810ae830 __CFRunLoopRun + 724
17 CoreFoundation 0x180fd8c50 CFRunLoopRunSpecific + 384
18 GraphicsServices 0x1828c0088 GSEventRunModal + 180
19 UIKit 0x1862c2088 UIApplicationMain + 204
20 Smartphone 0x1000e0b78 main (main.m:13)
21 libdispatch.dylib 0x180b768b8 (Missing)
Also I am not able to figure out where exactly the crash is happening. Since I am getting these as part of release build.
When running my app I occasionally get this crash that seems not to have anything with my code. What is it and how my I avert it?
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0
Crashed: 0 libsystem_kernel.dylib 0x000000018fc4c16c
mach_msg_trap + 8 1 libsystem_kernel.dylib
0x000000018fc4bfdc mach_msg + 72 2 AudioToolbox
0x0000000193c8bcdc ASClient_AudioSessionSetActiveWithFlags + 132 3
AudioToolbox 0x0000000193c6c7f4
AudioSessionSetActive_Priv + 360 4 AVFAudio
0x00000001aa46bf8c -[AVAudioSession setActive:withOptions:error:] +
84 5 Jam Session 0x00000001000d41b8 0x1000b0000 +
147896 6 Jam Session 0x00000001000d53fc
0x1000b0000 + 152572 7 UIKit
0x0000000196ae90ec -[UIViewController loadViewIfRequired] + 1056 8
UIKit 0x0000000196ba2cdc
-[UINavigationController _layoutViewController:] + 72 9 UIKit 0x0000000196ba2bb4 -[UINavigationController
_updateScrollViewFromViewController:toViewController:] + 416 10 UIKit 0x0000000196ba1efc -[UINavigationController
_startTransition:fromViewController:toViewController:] + 140 11 UIKit 0x0000000196ba1948 -[UINavigationController
_startDeferredTransitionIfNeeded:] + 856 12 UIKit 0x0000000196ba14fc -[UINavigationController viewWillLayoutSubviews]
+ 64 13 UIKit 0x0000000196ba1460 -[UILayoutContainerView layoutSubviews] + 188 14 UIKit 0x0000000196ae625c -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
+ 1196 15 QuartzCore 0x0000000193fad2c8 -[CALayer layoutSublayers] + 148 16 QuartzCore
0x0000000193fa1fa4 CA::Layer::layout_if_needed(CA::Transaction*) +
292 17 QuartzCore 0x0000000193fa1e64
CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32 18
QuartzCore 0x0000000193f1eb20
CA::Context::commit_transaction(CA::Transaction*) + 252 19 QuartzCore
0x0000000193f45f8c CA::Transaction::commit() + 512 20 QuartzCore
0x0000000193f469ac
CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned
long, void*) + 120 21 CoreFoundation
0x0000000190c4a7dc
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 32 22 CoreFoundation 0x0000000190c4840c
__CFRunLoopDoObservers + 372 23 CoreFoundation 0x0000000190b77068 CFRunLoopRunSpecific + 476 24 UIKit
0x0000000196b542ec -[UIApplication _run] + 608 25 UIKit
0x0000000196b4f070 UIApplicationMain + 208 26 Jam Session
0x00000001000c36d4 0x1000b0000 + 79572 27 libdyld.dylib
0x000000018fb585b8 start + 4
I came across this issue today after subclassing a UIView. To resolve this I did the following:
Add an Exception Breakpoint for all exceptions
Enable Zombie Objects
After viewing the thread stack on the left pane, I noticed something related to "key path" and "value".. then I realised that when creating my subclass, I'd created an IBInspectable and updated this value in the storyboard. I later removed this and this is what caused the crash, because the class was still trying to set this value at runtime.
So make sure to check your "User Defined Runtime Attributes".
This crash occurs when using NSNotificationCenter
You registered a notification observer to an object that has been released and didn't removed the observer. So when it tries to call the selector it crashes.
If you are using a ViewController of some kind, you can add
[[NSNotificationCenter defaultCenter] removeObserver:self name:#"Notification" object:nil];
to the viewWillDisappear
if it is not a ViewController you can use -(void) dealloc to unregister the Observer.
In case you to debug further to exactly figure out the point of origin of crash. Put an exception breakpoint in the breakpoints tab and run the app, do casual testing and see if you get the crash.
This should work..
Cheers!