App Crashing (EXC_BAD_ACCESS) only in RTL Languages like Arabic - ios

App is crashing with EXC_BAD_ACCESS exception only in RTL mode whereas the app is working fine in LTR mode. I'm running the app by forcing it in RTL mode as below,
Edit Scheme -> Run -> Option -> App Language -> Right to Left Pseudo Language.
It is crashing in UIApplicationMain with following stack trace
0x12495a1bb <+94>: movq 0x47896(%rip), %rsi ; "overflowEngineVarIndexForEngine:"
0x12495a1c2 <+101>: movq %r14, %rdi
0x12495a1c5 <+104>: movq %rbx, %rdx
0x12495a1c8 <+107>: callq *0x3d022(%rip) ; (void *)0x0000000113ecd7c0: objc_msgSend
0x12495a1ce <+113>: jmp 0x12495a1d5 ; <+120>
0x12495a1d0 <+115>: movl $0xffffffff, %eax ; imm = 0xFFFFFFFF
0x12495a1d5 <+120>: movq 0xc0(%rbx), %rcx
0x12495a1dc <+127>: movl %eax, %eax
0x12495a1de <+129>: movq %rax, %rdx
0x12495a1e1 <+132>: shrq $0x6, %rdx
-> 0x12495a1e5 <+136>: movq (%rcx,%rdx,8), %rcx Thread 1: EXC_BAD_ACCESS (code=2, address=0x6190201a4f78)
0x12495a1e9 <+140>: andl $0x3f, %eax
0x12495a1ec <+143>: shlq $0x5, %rax
0x12495a1f0 <+147>: leaq (%rcx,%rax), %r15
Crash Log Looks like this
Thread 0:: Dispatch queue: com.apple.main-thread
0 ??? 0x110739ad8 ???
1 ??? 0x111e93948 ???
2 CoreAutoLayout 0x128b4e3e9 -[NSISEngine negativeErrorVarForBrokenConstraintWithMarker:errorVar:] + 89
3 CoreAutoLayout 0x128b5716f -[NSISEngine removeConstraintWithMarker:] + 1102
4 CoreAutoLayout 0x128b6ca30 -[NSLayoutConstraint _removeFromEngine:] + 209
5 UIKitCore 0x13ecd4dd0 -[UIView _layoutEngine_willRemoveLayoutConstraint:] + 80
6 UIKitCore 0x13ecd589c -[UIView(UIConstraintBasedLayout) nsli_removeConstraint:] + 90
7 CoreAutoLayout 0x128b6de31 __55+[NSLayoutConstraint _addOrRemoveConstraints:activate:]_block_invoke + 53
8 CoreAutoLayout 0x128b5458f -[NSISEngine withBehaviors:performModifications:] + 84
9 CoreAutoLayout 0x128b6dd0a +[NSLayoutConstraint _addOrRemoveConstraints:activate:] + 398
10 UIKitCore 0x13ece22f8 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 580
11 UIKitCore 0x13ece344d -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 154
12 UIKitCore 0x13ece4556 -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 374
13 UIKitCore 0x13ede1561 -[UIView _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 352
14 UIKitCore 0x13edf559f -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2305
15 QuartzCore 0x11b49302c CA::Layer::layout_if_needed(CA::Transaction*) + 526
16 QuartzCore 0x11b49e5b9 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 65
17 QuartzCore 0x11b3afb0c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 626
18 QuartzCore 0x11b3e769b CA::Transaction::commit() + 735
19 QuartzCore 0x11b3e8b64 CA::Transaction::flush_as_runloop_observer(bool) + 60
20 CoreFoundation 0x11f3df055 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
21 CoreFoundation 0x11f3d99c2 __CFRunLoopDoObservers + 515
22 CoreFoundation 0x11f3d9f0d __CFRunLoopRun + 1161
23 CoreFoundation 0x11f3d96a7 CFRunLoopRunSpecific + 560
24 GraphicsServices 0x12793128a GSEventRunModal + 139
25 UIKitCore 0x13e7c2ad3 -[UIApplication _run] + 994
26 UIKitCore 0x13e7c79ef UIApplicationMain + 123
27 libswiftUIKit.dylib 0x1267f3c72 UIApplicationMain(_:_:_:_:) + 98
28 Bookings 0x105de34c0 main + 560 (main.swift:12)
29 dyld_sim 0x1170582bf start_sim + 10
30 dyld 0x20cd81310 start + 2432
I have enabled Constraint Error Breakpoint , Exception Breakpoint and Run Time Issue Breakpoint but have no luck in finding any clue about the issue. Have used instruments to find memory leaks but had no luck there too since it showed as no leaks.
So from crash logs it is clear that app is crashing coz of something went wrong inside Autolayout engine (which may be coz of some contradicting constraints) and I can't check all the constraints since app has huge number of them. How can find the root cause of this crash and fix this issue.
I would appreciate any help in finding the root cause of this crash issue.

Related

iOS App crashes only on release mode with segmentation fault

I have an old iOS app that's only crashing on Release Mode. It's using some objective-c extensions and I found that under one of the extension, if I removed a line that look something like
self.containerView.addSubview(self.pageViewController.view);
then the app doesn't crash. If this line is commented out, the app doesn't show the subview as expected so it seems like when the sub view loads the app crashes. Interestingly the same line is being executed multiple times in different part of the app to load similar kind of views and none of them crashes except only one page. I tried to replace the data that the view is loading using plist to see if it's a data issue since the same extension is loading other pages fine but no luck. I have also analyzed the crash logs and use exception break point, Zombie and Memory leaks using Instrument and nothing is giving any clue. The app crashes with a breakpoint on first line of AppDelegate function indicating it's crashing outside the main code.
Below is the crash log from the device
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4302422016
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 10071c000-100c04000 [ 5024K] r-x/r-x SM=COW ...art.app/Smart
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [1327]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001990eb270 object_getMethodImplementation + 68
1 CoreFoundation 0x0000000184d8f608 _NSIsNSArray + 36
2 CoreFoundation 0x0000000184d8f608 _NSIsNSArray + 36
3 CoreFoundation 0x0000000184c779ac -[NSMutableArray addObjectsFromArray:] + 72
4 UIKitCore 0x0000000187a0fb28 -[UIView+ 16063272 (AdditionalLayoutSupport) _accumulateViewConstraintsIntoArray:] + 92
5 UIKitCore 0x0000000187a10b14 -[UIView+ 16067348 (AdditionalLayoutSupport) _switchToLayoutEngine:] + 108
6 UIKitCore 0x0000000187a10ea4 __57-[UIView+ 16068260 (AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 184
7 CoreAutoLayout 0x000000019936f934 -[NSISEngine withBehaviors:performModifications:] + 80
8 UIKitCore 0x0000000187a10db0 __57-[UIView+ 16068016 (AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 536
9 UIKitCore 0x0000000187a10b64 -[UIView+ 16067428 (AdditionalLayoutSupport) _switchToLayoutEngine:] + 188
10 UIKitCore 0x0000000187a10ea4 __57-[UIView+ 16068260 (AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 184
11 CoreAutoLayout 0x000000019936f934 -[NSISEngine withBehaviors:performModifications:] + 80
12 UIKitCore 0x0000000187a10db0 __57-[UIView+ 16068016 (AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 536
13 UIKitCore 0x0000000187a10b64 -[UIView+ 16067428 (AdditionalLayoutSupport) _switchToLayoutEngine:] + 188
14 UIKitCore 0x0000000187a0fd8c -[UIView+ 16063884 (AdditionalLayoutSupport) _initializeHostedLayoutEngine] + 208
15 UIKitCore 0x0000000187a04628 -[UIView+ 16016936 (UIConstraintBasedLayout) _layoutEngine_windowDidChange] + 124
16 UIKitCore 0x0000000187aed594 -[UIView+ 16971156 (Internal) _didMoveFromWindow:toWindow:] + 260
17 UIKitCore 0x0000000187aed730 -[UIView+ 16971568 (Internal) _didMoveFromWindow:toWindow:] + 672
18 UIKitCore 0x0000000187aed730 -[UIView+ 16971568 (Internal) _didMoveFromWindow:toWindow:] + 672
19 UIKitCore 0x0000000187a6dfe8 -[UIScrollView _didMoveFromWindow:toWindow:] + 92
20 UIKitCore 0x0000000187aed730 -[UIView+ 16971568 (Internal) _didMoveFromWindow:toWindow:] + 672
21 UIKitCore 0x0000000187aed730 -[UIView+ 16971568 (Internal) _didMoveFromWindow:toWindow:] + 672
22 UIKitCore 0x0000000187aed730 -[UIView+ 16971568 (Internal) _didMoveFromWindow:toWindow:] + 672
23 UIKitCore 0x0000000187aed730 -[UIView+ 16971568 (Internal) _didMoveFromWindow:toWindow:] + 672
24 UIKitCore 0x0000000187aed730 -[UIView+ 16971568 (Internal) _didMoveFromWindow:toWindow:] + 672
25 UIKitCore 0x0000000187ae1b78 __45-[UIView+ 16923512 (Hierarchy) _postMovedFromSuperview:]_block_invoke + 136
26 CoreAutoLayout 0x000000019936f934 -[NSISEngine withBehaviors:performModifications:] + 80
27 UIKitCore 0x0000000187ae1a80 -[UIView+ 16923264 (Hierarchy) _postMovedFromSuperview:] + 776
28 UIKitCore 0x0000000187af00d8 -[UIView+ 16982232 (Internal) _addSubview:positioned:relativeTo:] + 2132
29 UIKitCore 0x0000000187ab0ed0 -[UINavigationTransitionView transition:fromView:toView:] + 604
30 UIKitCore 0x0000000186e739f8 -[UINavigationController _startTransition:fromViewController:toViewController:] + 2764
31 UIKitCore 0x0000000186e73eb0 -[UINavigationController _startDeferredTransitionIfNeeded:] + 876
32 UIKitCore 0x0000000186e75230 -[UINavigationController __viewWillLayoutSubviews] + 164
33 UIKitCore 0x0000000186e580c8 -[UILayoutContainerView layoutSubviews] + 224
34 UIKitCore 0x0000000187af6448 -[UIView+ 17007688 (CALayerDelegate) layoutSublayersOfLayer:] + 2468
35 QuartzCore 0x0000000187ffbf2c -[CALayer layoutSublayers] + 288
36 QuartzCore 0x00000001880024d0 CA::Layer::layout_if_needed+ 1426640 (CA::Transaction*) + 520
37 QuartzCore 0x000000018800d820 CA::Layer::layout_and_display_if_needed+ 1472544 (CA::Transaction*) + 140
38 QuartzCore 0x0000000187f59160 CA::Context::commit_transaction+ 733536 (CA::Transaction*, double, double*) + 416
39 QuartzCore 0x0000000187f83324 CA::Transaction::commit+ 906020 () + 728
40 QuartzCore 0x0000000187f845d4 CA::Transaction::observer_callback+ 910804 (__CFRunLoopObserver*, unsigned long, void*) + 92
41 CoreFoundation 0x0000000184d0287c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
42 CoreFoundation 0x0000000184cfcf50 __CFRunLoopDoObservers + 604
43 CoreFoundation 0x0000000184cfd498 __CFRunLoopRun + 960
44 CoreFoundation 0x0000000184cfcba0 CFRunLoopRunSpecific + 572
45 GraphicsServices 0x000000019ba3a598 GSEventRunModal + 160
46 UIKitCore 0x00000001875ec3d8 -[UIApplication _run] + 1052
47 UIKitCore 0x00000001875f1958 UIApplicationMain + 164
48 Smart 0x000000010073fb2c main + 146220 (AppDelegate.swift:85)
49 libdyld.dylib 0x00000001849db568 start + 4
Not sure where the segmentation fault is happening and where is the array. Will appreciate any suggestions or directions on this.

"NSInternalInconsistencyException: threading violation: expected the main thread" outside of my code

My iOS App is crashing with the following error:
*** Assertion failure in -[FBSSerialQueue assertOnQueue], /BuildRoot/Library/Caches/com.apple.xbs/Sources/FrontBoardServices/FrontBoard-626.4.1/FrontBoardServices/FBSSerialQueue.m:98
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'threading violation: expected the main thread'
And this is the stacktrace:
Exception: NSInternalInconsistencyException
Reason: threading violation: expected the main thread
Stacktrace: (
0 CoreFoundation 0x000000018d56c980 DC2C95C6-B954-39E8-86A2-5E0AF8801E87 + 1255808
1 libobjc.A.dylib 0x000000018d285028 objc_exception_throw + 60
2 CoreFoundation 0x000000018d4694fc DC2C95C6-B954-39E8-86A2-5E0AF8801E87 + 193788
3 Foundation 0x000000018d8aa690 7A7A96AF-79E4-3DB1-8904-42E61CAE8999 + 571024
4 FrontBoardServices 0x00000001927ae7ec 370F1F18-E8A9-36B5-B0EB-9735A02CE2DE + 366572
5 FrontBoardServices 0x0000000192760460 370F1F18-E8A9-36B5-B0EB-9735A02CE2DE + 46176
6 FrontBoardServices 0x00000001927606ec 370F1F18-E8A9-36B5-B0EB-9735A02CE2DE + 46828
7 FrontBoardServices 0x00000001927605e4 370F1F18-E8A9-36B5-B0EB-9735A02CE2DE + 46564
8 UIKitCore 0x00000001911e1c40 AAFEFEBE-C172-3346-8972-810EB8F2F2C6 + 5995584
9 UIKitCore 0x00000001912d1870 AAFEFEBE-C172-3346-8972-810EB8F2F2C6 + 6977648
10 UIKitCore 0x00000001912d2640 AAFEFEBE-C172-3346-8972-810EB8F2F2C6 + 6981184
11 CameraUI 0x00000001afbb8514 289C074B-4FFE-3D83-927A-98B268DD914F + 652564
12 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
13 CameraUI 0x00000001afc5b118 289C074B-4FFE-3D83-927A-98B268DD914F + 1319192
14 libobjc.A.dylib 0x000000018d284130 2C18C54E-6C84-310C-851F-F9602890D908 + 20784
15 libobjc.A.dylib 0x000000018d296f80 objc_destructInstance + 92
16 libobjc.A.dylib 0x000000018d29de44 _objc_rootDealloc + 52
17 CameraUI 0x00000001afc502c4 289C074B-4FFE-3D83-927A-98B268DD914F + 1274564
18 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
19 CoreFoundation 0x000000018d4b243c DC2C95C6-B954-39E8-86A2-5E0AF8801E87 + 492604
20 CoreFoundation 0x000000018d43cfc0 DC2C95C6-B954-39E8-86A2-5E0AF8801E87 + 12224
21 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
22 CameraUI 0x00000001afcb3704 289C074B-4FFE-3D83-927A-98B268DD914F + 1681156
23 libobjc.A.dylib 0x000000018d284130 2C18C54E-6C84-310C-851F-F9602890D908 + 20784
24 libobjc.A.dylib 0x000000018d296f80 objc_destructInstance + 92
25 libobjc.A.dylib 0x000000018d29de44 _objc_rootDealloc + 52
26 CameraUI 0x00000001afca48ac 289C074B-4FFE-3D83-927A-98B268DD914F + 1620140
27 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
28 libsystem_blocks.dylib 0x000000018d18fa08 _Block_release + 168
29 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
30 libsystem_blocks.dylib 0x000000018d18fa08 _Block_release + 168
31 libdispatch.dylib 0x0000000102d3b27c _dispatch_client_callout + 20
32 libdispatch.dylib 0x0000000102d4290c _dispatch_lane_serial_drain + 720
33 libdispatch.dylib 0x0000000102d434fc _dispatch_lane_invoke + 408
34 libdispatch.dylib 0x0000000102d4e4dc _dispatch_workloop_worker_thread + 1344
35 libsystem_pthread.dylib 0x000000018d2776d0 _pthread_wqthread + 280
36 libsystem_pthread.dylib 0x000000018d27d9e8 start_wqthread + 8
)
Is seems to be completely outside of my code. Is there any way to debug this? Is it a bug in an iOS component?
The UIImagePickerController seems to be involved. It seems to happen shortly after picking a foto via the camera.
EDIT: Here is what the debug navigator is showing right after the crash:
And one more screenshot:
I cannot identify a single action in the app that reproduces the crash. I need to click around in a component that takes a picture from the camera and saves it into a UICollectionView. Only sometimes and eventually, the crash happens at different points.
I've verified that the code inside imagePickerController:didFinishPickingMediaWithInfo: is running on the main thread.
How can I locate the exact place in my the code where this crash is happening?
EDIT 2: Update from Apple developer technical support; they believe that it is a bug and they suggest filing a bug report.
In iOS14 UIImagePicker is being deprecated, so I would suggest wrapping your code in an iOS version check and using the new PHPickerViewController instead. Not the best solutions, but it's something.

ScrollViewDidScroll EXC_BREAKPOINT crash only on iOS 13

I seem to be getting this error after my new release and its only happening on iOS 13 with most cases of upto 83% of the crash happening on iOS 13.3.1. I am not sure how to fix this error and I have been going through the code and cannot seem to figure out the change in iOS 13 that causes scrollViewDidScroll delegate method to crash the app.
Any help is greatly appreciated. It is also important to note that I haven't been able to reproduce this error, it only happens to users in production.
Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x0000000104620bb0
Crashed: com.apple.main-thread
0 Motoz-AppStore 0x104620bb0 ProfileBrowserViewController.scrollViewDidScroll(_:) + 4299967408 (<compiler-generated>:4299967408)
1 Motoz-AppStore 0x104620d54 #objc ProfileBrowserViewController.scrollViewDidScroll(_:) + 4299967828 (<compiler-generated>:4299967828)
2 UIKitCore 0x1be3c6a24 -[UIScrollView _notifyDidScroll] + 76
3 UIKitCore 0x1be3b0c34 -[UIScrollView setContentOffset:] + 1016
4 UIKitCore 0x1bd8153d4 -[UICollectionView setContentOffset:] + 48
5 UIKitCore 0x1be3cdd28 -[UIScrollView _adjustContentOffsetIfNecessary] + 60
6 UIKitCore 0x1be3af1cc -[UIScrollView setFrame:] + 484
7 UIKitCore 0x1bd802e7c -[UICollectionView setFrame:] + 460
8 UIKitCore 0x1be41b878 -[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 576
9 UIKitCore 0x1be41c510 -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 236
10 UIKitCore 0x1be355b84 -[UIScrollView(_UIOldConstraintBasedLayoutSupport) _resizeWithOldSuperviewSize:] + 52
11 CoreFoundation 0x1b9eed95c __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 16
12 CoreFoundation 0x1b9df0fb0 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 416
13 UIKitCore 0x1be41b5e4 -[UIView(Geometry) resizeSubviewsWithOldSize:] + 156
14 UIKitCore 0x1be419938 -[UIView(Geometry) setFrame:] + 700
15 UIKitCore 0x1bd8e519c -[UINavigationController _startCustomTransition:] + 1212
16 UIKitCore 0x1bd8f9168 -[UINavigationController _startDeferredTransitionIfNeeded:] + 680
17 UIKitCore 0x1bd8fa55c -[UINavigationController __viewWillLayoutSubviews] + 164
18 UIKitCore 0x1bd8dd9e0 -[UILayoutContainerView layoutSubviews] + 224
19 UIKitCore 0x1be43617c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2140
20 QuartzCore 0x1c099e2c0 -[CALayer layoutSublayers] + 284
21 QuartzCore 0x1c09a443c CA::Layer::layout_if_needed(CA::Transaction*) + 480
22 QuartzCore 0x1c09af140 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
23 QuartzCore 0x1c08f7884 CA::Context::commit_transaction(CA::Transaction*, double) + 304
24 QuartzCore 0x1c0921574 CA::Transaction::commit() + 676
25 QuartzCore 0x1c0921f68 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
26 CoreFoundation 0x1b9e97e68 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
27 CoreFoundation 0x1b9e92d54 __CFRunLoopDoObservers + 416
28 CoreFoundation 0x1b9e93320 __CFRunLoopRun + 1308
29 CoreFoundation 0x1b9e92adc CFRunLoopRunSpecific + 464
30 GraphicsServices 0x1c3e33328 GSEventRunModal + 104
31 UIKitCore 0x1bdfa063c UIApplicationMain + 1936
32 Motoz-AppStore 0x1043fed70 main + 17 (TeraHeaderView.swift:17)
33 libdyld.dylib 0x1b9d1c360 start + 4
I can not say a concrete answer unless you show a piece of code but there is a possibility that error might occur because of delegation structure. Just in case check your delegation of scrollviews(tableviews, collection views, embedded web-views as well). Please check the link link for more info.

[NSNull length]: unrecognized selector sent to instance on keyboard keystroke?

I have added some textField and textView on static table view. the code was fine and running on xcode 6.4 / ios 8. * but it is throwing exception which i am not able to track. now i am debugging code on xcode 7.2 (swift2.2)
I tried putting symbolic and and exceptional break point too but no luck :(
following is stack trace of crash, Thanks in advance for your valuable help.
2015-12-14 16:07:07.989 TuteMate[3380:90711] -[NSNull length]: unrecognized selector sent to instance 0x10ccc6af0
from exceptional breakpoint :
CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:]:
-> 0x10504e3c0 <+0>: pushq %rbp
0x10504e3c1 <+1>: movq %rsp, %rbp
0x10504e3c4 <+4>: pushq %r15
0x10504e3c6 <+6>: pushq %r14
0x10504e3c8 <+8>: pushq %rbx
0x10504e3c9 <+9>: pushq %rax
0x10504e3ca <+10>: movq %rdx, %r14
0x10504e3cd <+13>: movq %rdi, %rbx
0x10504e3d0 <+16>: movq 0x216c79(%rip), %rsi ; "class"
0x10504e3d7 <+23>: callq *0x229e1b(%rip) ; (void *)0x000000010730b800: objc_msgSend
0x10504e3dd <+29>: movq %rax, %rdi
0x10504e3e0 <+32>: movq %rbx, %rsi
0x10504e3e3 <+35>: movq %r14, %rdx
0x10504e3e6 <+38>: callq 0x10504ed00 ; __CFFullMethodName
0x10504e3eb <+43>: movq %rax, %r14
0x10504e3ee <+46>: leaq 0x23fdeb(%rip), %r15 ; #"%#: unrecognized selector sent to instance %p"
0x10504e3f5 <+53>: movl $0x3, %edi
0x10504e3fa <+58>: xorl %eax, %eax
0x10504e3fc <+60>: movq %r15, %rsi
0x10504e3ff <+63>: movq %r14, %rdx
0x10504e402 <+66>: movq %rbx, %rcx
0x10504e405 <+69>: callq 0x104fe2560 ; CFLog
0x10504e40a <+74>: leaq 0x22b90f(%rip), %rax ; kCFAllocatorSystemDefault
0x10504e411 <+81>: movq (%rax), %rdi
0x10504e414 <+84>: xorl %esi, %esi
0x10504e416 <+86>: xorl %eax, %eax
0x10504e418 <+88>: movq %r15, %rdx
0x10504e41b <+91>: movq %r14, %rcx
0x10504e41e <+94>: movq %rbx, %r8
0x10504e421 <+97>: callq 0x104f35190 ; CFStringCreateWithFormat
0x10504e426 <+102>: movq %rax, %rdi
0x10504e429 <+105>: callq 0x104f33580 ; CFMakeCollectable
0x10504e42e <+110>: movq %rax, %rbx
0x10504e431 <+113>: movq %rbx, %rdi
0x10504e434 <+116>: nop
0x10504e435 <+117>: nopl (%rax)
0x10504e439 <+121>: leaq 0x225300(%rip), %rax ; __CFOASafe
0x10504e440 <+128>: cmpb $0x0, (%rax)
0x10504e443 <+131>: je 0x10504e459 ; <+153>
0x10504e445 <+133>: movl $0x3, %edi
0x10504e44a <+138>: xorl %edx, %edx
0x10504e44c <+140>: xorl %ecx, %ecx
0x10504e44e <+142>: xorl %r8d, %r8d
0x10504e451 <+145>: movq %rbx, %rsi
0x10504e454 <+148>: callq 0x10501b150 ; __CFRecordAllocationEvent
0x10504e459 <+153>: movq %rbx, %rdi
0x10504e45c <+156>: callq 0x1050a3696 ; symbol stub for: _objc_rootAutorelease
0x10504e461 <+161>: movq 0x218370(%rip), %rdi ; (void *)0x00000001052690d0: NSException
0x10504e468 <+168>: leaq 0x234fb1(%rip), %rcx ; NSInvalidArgumentException
0x10504e46f <+175>: movq (%rcx), %rdx
0x10504e472 <+178>: movq 0x216c4f(%rip), %rsi ; "exceptionWithName:reason:userInfo:"
0x10504e479 <+185>: xorl %r8d, %r8d
0x10504e47c <+188>: movq %rax, %rcx
0x10504e47f <+191>: callq *0x229d73(%rip) ; (void *)0x000000010730b800: objc_msgSend
0x10504e485 <+197>: movq %rax, %rdi
0x10504e488 <+200>: callq 0x1050a3738 ; symbol stub for: objc_exception_throw
0x10504e48d <+205>: nopl (%rax)
update stack Trace
2015-12-14 16:45:58.932 TuteMate[4000:109943] -[NSNull length]: unrecognized selector sent to instance 0x105b72af0
2015-12-14 16:46:02.651 TuteMate[4000:109943] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x105b72af0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010594de65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000107bfddeb objc_exception_throw + 48
2 CoreFoundation 0x000000010595648d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001058a390a ___forwarding___ + 970
4 CoreFoundation 0x00000001058a34b8 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x0000000105825dfa CFStringCompareWithOptionsAndLocale + 202
6 Foundation 0x0000000106019e37 -[NSString compare:options:range:] + 29
7 UIKit 0x00000001069c4e6f -[UIPhysicalKeyboardEvent _matchesKeyCommand:] + 303
8 UIKit 0x00000001068e93fd -[UIResponder _keyCommandForEvent:target:] + 364
9 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
10 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
11 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
12 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
13 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
14 UIKit 0x00000001068e95b2 -[UIResponder _keyCommandForEvent:target:] + 801
15 UIKit 0x00000001066fb91a -[UIApplication _handleKeyUIEvent:] + 948
16 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
17 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
18 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
19 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
20 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
21 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
22 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
23 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
24 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
25 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
26 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
27 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
28 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
29 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
30 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
31 UIKit 0x00000001068e9e53 -[UIResponder _handleKeyUIEvent:] + 79
32 UIKit 0x00000001066fb2cd -[UIApplication handleKeyUIEvent:] + 79
33 UIKit 0x0000000106991c83 -[UIKeyboardImpl _handleKeyEvent:executionContext:] + 66
34 UIKit 0x0000000106b91cde -[UIKeyboardLayoutStar completeRetestForTouchUp:timestamp:interval:executionContext:] + 3356
35 UIKit 0x00000001069a0bbd __28-[UIKeyboardLayout touchUp:]_block_invoke + 228
36 UIKit 0x00000001070ed724 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 332
37 UIKit 0x00000001069a0ace -[UIKeyboardLayout touchUp:] + 236
38 UIKit 0x00000001069a1614 -[UIKeyboardLayout touchesEnded:withEvent:] + 348
39 UIKit 0x000000010674b49b -[UIWindow _sendTouchesForEvent:] + 835
40 UIKit 0x000000010674c1d0 -[UIWindow sendEvent:] + 865
41 UIKit 0x00000001066fab66 -[UIApplication sendEvent:] + 263
42 UIKit 0x00000001066d4d97 _UIApplicationHandleEventQueue + 6844
43 CoreFoundation 0x0000000105879a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
44 CoreFoundation 0x000000010586f95c __CFRunLoopDoSources0 + 556
45 CoreFoundation 0x000000010586ee13 __CFRunLoopRun + 867
46 CoreFoundation 0x000000010586e828 CFRunLoopRunSpecific + 488
47 GraphicsServices 0x000000010c9daad2 GSEventRunModal + 161
48 UIKit 0x00000001066da610 UIApplicationMain + 171
49 TuteMate 0x000000010500128d main + 109
50 libdyld.dylib 0x000000010932c92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
UPDATE
There are no other viewWillAppeaer, didAppear... methods implemented!
override func viewDidLoad() {
super.viewDidLoad()
title = "Profile Edit"
}
And table viewDelegates are
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 3
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = super.tableView(tableView, cellForRowAtIndexPath: indexPath)
return cell
}
#dip: From your comments it seems that you need to learn something very important about debugging, and that is: Everything you believe is false. When you say "I don't store null or anything like that", we know that is false. And the second most important rule: Trust the evidence.
The evidence is that a message "length:" which is an NSString method is sent to [NSNull null]. Somewhere you are storing [NSNull null] where you should store a string. Third rule of debugging: You did something wrong. There are no mysterious gremlins trying to upset you, it's your code that's wrong. So find out where you are storing an [NSNull null]. Anything coming from a JSON parser is always a good candidate.
Possible Solution:
My issue was caused because I inadvertently clicked on the Key Commands controls in the attribute inspector.
Check out my response here:
https://stackoverflow.com/a/36187611/5006807
I hope it helps....

determining what originated a crash in my code

I'm getting crashes in a user's device (I see it in Crashalytics)
The thing is that the core dump is all iOS internal stuff.
How can I see what peice of my code originated the draw that made the crash?
Terminating app due to an uncaught exception 'NSInvalidArgumentException', reason: '-[NSAttributeDictionary textContainerForAttributedString:containerSize:lineFragmentPadding:]: unrecognized selector sent to instance 0x15dc7f20'
0 CoreFoundation 0x30065f23 +154
1 libobjc.A.dylib 0x3a7fcce7 objc_exception_throw+38
2 CoreFoundation 0x30069837 +202
3 CoreFoundation 0x30068137 +706
4 CoreFoundation 0x2ffb7098 _CF_forwarding_prep_0+24
5 UIFoundation 0x37ce5915 +12252
6 UIFoundation 0x37ce2863 +150
7 UIKit 0x328ae2c9 +4224
8 UIKit 0x32914709 +500
9 UIKit 0x3291450b +78
10 UIKit 0x329144a9 +372
11 QuartzCore 0x32540189 +100
12 QuartzCore 0x32529c5b +1858
13 QuartzCore 0x32605c1d +52
14 QuartzCore 0x3252950b +82
15 QuartzCore 0x325291bf +1118
16 QuartzCore 0x3250cd41 +208
17 QuartzCore 0x3250c9d9 +24
18 QuartzCore 0x3250c3e5 +228
19 QuartzCore 0x3250c1f7 +314
20 QuartzCore 0x325398e3 +162
21 libsystem_pthread.dylib 0x3ae176d1 +164
22 libsystem_pthread.dylib 0x3ae17453 +86
23 libsystem_pthread.dylib 0x3ae181b9 pthread_exit+28
24 Foundation 0x309a2703 +10
25 Foundation 0x30a4ea2d +1092
26 libsystem_pthread.dylib 0x3ae18959 +140
27 libsystem_pthread.dylib 0x3ae188cb _pthread_start+102
** Edit **
A different thread that crashed in this run (which again gives me no hints to the original point in my code)
Thread : Crashed: Thread
0 libsystem_c.dylib 0x3ad6206a __abort + 101
1 libsystem_c.dylib 0x3ad6206b __abort + 102
2 libsystem_c.dylib 0x3ad62005 __abort
3 libc++abi.dylib 0x3a1b098f abort_message + 74
4 libc++abi.dylib 0x3a1c96e7 default_terminate_handler() + 254
5 libobjc.A.dylib 0x3a7fcf7d _objc_terminate() + 192
6 libc++abi.dylib 0x3a1c71b3 std::__terminate(void (*)()) + 78
7 libc++abi.dylib 0x3a1c6a09 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
8 libobjc.A.dylib 0x3a7fcdbb objc_exception_throw + 250
9 CoreFoundation 0x30069837 -[NSObject(NSObject) doesNotRecognizeSelector:] + 202
10 CoreFoundation 0x30068137 ___forwarding___ + 706
11 CoreFoundation 0x2ffb7098 _CF_forwarding_prep_0 + 24
12 UIFoundation 0x37ce5915 __NSStringDrawingEngine + 12252
13 UIFoundation 0x37ce2863 -[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 150
14 UIKit 0x328ae2c9 -[UILabel _drawTextInRect:baselineCalculationOnly:] + 4224
15 UIKit 0x32914709 -[UILabel drawTextInRect:] + 500
16 UIKit 0x3291450b -[UILabel drawRect:] + 78
17 UIKit 0x329144a9 -[UIView(CALayerDelegate) drawLayer:inContext:] + 372
18 QuartzCore 0x32540189 -[CALayer drawInContext:] + 100
19 QuartzCore 0x32529c5b CABackingStoreUpdate_ + 1858
20 QuartzCore 0x32605c1d ___ZN2CA5Layer8display_Ev_block_invoke + 52
21 QuartzCore 0x3252950b x_blame_allocations + 82
22 QuartzCore 0x325291bf CA::Layer::display_() + 1118
23 QuartzCore 0x3250cd41 CA::Layer::display_if_needed(CA::Transaction*) + 208
24 QuartzCore 0x3250c9d9 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
25 QuartzCore 0x3250c3e5 CA::Context::commit_transaction(CA::Transaction*) + 228
26 QuartzCore 0x3250c1f7 CA::Transaction::commit() + 314
27 QuartzCore 0x325398e3 CA::Transaction::release_thread(void*) + 162
28 libsystem_pthread.dylib 0x3ae176d1 _pthread_tsd_cleanup + 164
29 libsystem_pthread.dylib 0x3ae17453 _pthread_exit + 86
30 libsystem_pthread.dylib 0x3ae181b9 pthread_exit + 28
31 Foundation 0x309a2703 +[NSThread exit] + 10
32 Foundation 0x30a4ea2d __NSThread__main__ + 1092
33 libsystem_pthread.dylib 0x3ae18959 _pthread_body + 140
34 libsystem_pthread.dylib 0x3ae188cb _pthread_start + 102
What's unusual is that you are only getting this crash in production and not in development. That's probably due to poor testing, however another possible reason is making assumptions about the type of data you are working with, and this data is difficult to replicate in development.
JSON is a common and classic example of this, where a server can provide a string response that is magically turned into a hierarchy of objects. The code then assumes the top-level objects is a dictionary or array and starts calling methods which are unrecognised.
In your case though, you are not testing properly before release.
(this doesn't really provide an answer, but I feel you have everything you need to provide yourself with the answer, if you can be bothered to use it).

Resources