I am a newbie who is learning OC.
But now when I set an outlet button as a property of my viewcontroller, in order to add an attribute for it, when I write some methods in viewDidLoad, something wrong happened like this:
The only thing I want to do is to set the attributes of the outLetButton.currentTitle
And my code is as follows:
There is nothing wrong with my button.
(void)viewDidLoad {
[super viewDidLoad];
/
NSMutableAttributedString * title = [[NSMutableString alloc] initWithString:self.OutletButton.currentTitle] ;
[title setAttributes:#{NSStrokeWidthAttributeName:#3.0,NSStrokeColorAttributeName:[self.OutletButton tintColor]} range:NSMakeRange(0, [title length])] ;
[self.OutletButton setAttributedTitle:title forState:UIControlStateNormal] ;
}
I used breakout debugging, when I step over [title setAttributes...], it crashed.
First throw call stack
0 CoreFoundation 0x000000010ba0b12b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010b09ff41 objc_exception_throw + 48
2 CoreFoundation 0x000000010ba8c024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010b98df78 forwarding + 1432
4 CoreFoundation 0x000000010b98d958 _CF_forwarding_prep_0 + 120
5 UITextView 0x000000010a791106 -[ViewController viewDidLoad] + 598
6 UIKit 0x000000010c03146c -[UIViewController loadViewIfRequired] + 1235
7 UIKit 0x000000010c0318b9 -[UIViewController view] + 27
8 UIKit 0x000000010befc7cf -[UIWindow addRootViewControllerViewIfPossible] + 122
9 UIKit 0x000000010befced7 -[UIWindow _setHidden:forced:] + 294
10 UIKit 0x000000010bf0fe54 -[UIWindow makeKeyAndVisible] + 42
11 UIKit 0x000000010be828b8 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4737
12 UIKit 0x000000010be87aeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
13 UIKit 0x000000010c2516f8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
14 UIKit 0x000000010c6274c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
15 UIKit 0x000000010c2512f1 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
16 UIKit 0x000000010c251b6b -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696
17 UIKit 0x000000010cbcfa69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
18 UIKit 0x000000010cbcf922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
19 UIKit 0x000000010c8ac9c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
20 UIKit 0x000000010caabb06 _performActionsWithDelayForTransitionContext + 100
21 UIKit 0x000000010c8ac88b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
22 UIKit 0x000000010c626b25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
23 UIKit 0x000000010be8636a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
24 UIKit 0x000000010c461605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
25 FrontBoardServices 0x0000000110158cc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
26 FrontBoardServices 0x00000001101617b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
27 libdispatch.dylib 0x000000010f3b733d _dispatch_client_callout + 8
28 libdispatch.dylib 0x000000010f3bc9f3 _dispatch_block_invoke_direct + 592
29 FrontBoardServices 0x000000011018d498 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24
30 FrontBoardServices 0x000000011018d14e -[FBSSerialQueue _performNext] + 464
31 FrontBoardServices 0x000000011018d6bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
32 CoreFoundation 0x000000010b9ae101 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
33 CoreFoundation 0x000000010ba4df71 __CFRunLoopDoSource0 + 81
34 CoreFoundation 0x000000010b992a19 __CFRunLoopDoSources0 + 185
35 CoreFoundation 0x000000010b991fff __CFRunLoopRun + 1279
36 CoreFoundation 0x000000010b991889 CFRunLoopRunSpecific + 409
37 GraphicsServices 0x0000000110a219c6 GSEventRunModal + 62
38 UIKit 0x000000010be895d6 UIApplicationMain + 159
39 UITextView 0x000000010a7914df main + 111
40 libdyld.dylib 0x000000010f433d81 start + 1
41 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
The issue is because you are initialising NSMutableAttributedString with NSMutableString & then changes its attribute..
The code lets you initialise the variable But NSMutableString doesn't allow you to add attributes so it crashes..
The code should be like this.. (change allocation class to NSMutableAttributedString)
NSMutableAttributedString * title = [[NSMutableAttributedString alloc] initWithString:self.OutletButton.currentTitle] ;
[title setAttributes:#{NSStrokeWidthAttributeName:#3.0,NSStrokeColorAttributeName:[self.OutletButton tintColor]} range:NSMakeRange(0, [title length])] ;
[self.OutletButton setAttributedTitle:title forState:UIControlStateNormal] ;
Thanks.
Related
As the title says, my app immediately crashes when run if there is no internet connection/airplane mode is on. The thing is, when I set breakpoints it doesn't even make it to any of my code. Not a single viewDidLoad or even AppDelegate function gets called, and the error message doesn't seem like something that would be related to not having a network connection:
2019-03-21 10:30:20.193955-0500 AppName[98957:977030] *** Terminating
app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Could not load NIB in bundle: 'NSBundle
<bundleFilePath> (loaded)' with name
'BYZ-38-t0r-view-8bC-Xf-vdC''
(I obviously inserted some fake values into their for privacy)
Call stack:
*** First throw call stack:
(
0 CoreFoundation 0x00000001036cb1bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000102c69735 objc_exception_throw + 48
2 CoreFoundation 0x00000001036cb015 +[NSException raise:format:] + 197
3 UIKitCore 0x00000001088edd94 -[UINib instantiateWithOwner:options:] + 497
4 UIKitCore 0x0000000108661452 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
5 UIKitCore 0x0000000108661ddc -[UIViewController loadView] + 177
6 UIKitCore 0x00000001086620ee -[UIViewController loadViewIfRequired] + 175
7 UIKitCore 0x0000000108662940 -[UIViewController view] + 27
8 UIKitCore 0x000000010858134c -[UIPresentationController __sizeClassPair] + 62
9 UIKitCore 0x0000000108675428 -[UIViewController _presentViewController:withAnimationController:completion:] + 2300
10 UIKitCore 0x000000010867874b __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99
11 UIKitCore 0x0000000108678dd9 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 511
12 UIKitCore 0x00000001086786b1 -[UIViewController _presentViewController:animated:completion:] + 173
13 UIKitCore 0x00000001086789f0 -[UIViewController presentViewController:animated:completion:] + 150
14 AppName 0x0000000100f1125e $SSo16UIViewControllerC12DataScoutProE27showDismissiveAlertMesssage7messageySS_tF + 254
15 AppName 0x0000000100e58a97 $S12AppName18HomeViewControllerC10commonInit33_90D4AB13D5DB6EAFA2D0742F81F552BALLyyF + 727
16 AppName 0x0000000100e58462 $S12AppName18HomeViewControllerC5coderACSgSo7NSCoderC_tcfc + 146
17 AppName 0x0000000100e584df $S12AppName18HomeViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 47
18 UIKitCore 0x00000001088ec166 -[UIClassSwapper initWithCoder:] + 246
19 UIFoundation 0x000000010c8f35ad UINibDecoderDecodeObjectForValue + 749
20 UIFoundation 0x000000010c8f32b3 -[UINibDecoder decodeObjectForKey:] + 251
21 UIKitCore 0x00000001088f07b8 -[UIRuntimeConnection initWithCoder:] + 178
22 UIFoundation 0x000000010c8f35ad UINibDecoderDecodeObjectForValue + 749
23 UIFoundation 0x000000010c8f3854 UINibDecoderDecodeObjectForValue + 1428
24 UIFoundation 0x000000010c8f32b3 -[UINibDecoder decodeObjectForKey:] + 251
25 UIKitCore 0x00000001088ee067 -[UINib instantiateWithOwner:options:] + 1220
26 UIKitCore 0x0000000108e228b6 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
27 UIKitCore 0x0000000108c8103a -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 112
28 UIKitCore 0x0000000108c8150c -[UIApplication _loadMainInterfaceFile] + 272
29 UIKitCore 0x0000000108c7fb25 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1357
30 UIKitCore 0x000000010849e4e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
31 UIKitCore 0x00000001084a729c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
32 UIKitCore 0x000000010849e126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
33 UIKitCore 0x000000010849eae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
34 UIKitCore 0x000000010849ccb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795
35 UIKitCore 0x000000010849c95f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
36 UIKitCore 0x00000001084a1a90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584
37 UIKitCore 0x00000001084a280e _performActionsWithDelayForTransitionContext + 100
38 UIKitCore 0x00000001084a17ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221
39 UIKitCore 0x00000001084a693a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
40 UIKitCore 0x0000000108c7e44e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
41 UIKitCore 0x0000000108822d09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
42 FrontBoardServices 0x000000010f55e2da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
43 FrontBoardServices 0x000000010f569443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
44 FrontBoardServices 0x000000010f568b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
45 libdispatch.dylib 0x000000010548a602 _dispatch_client_callout + 8
46 libdispatch.dylib 0x000000010548db78 _dispatch_block_invoke_direct + 301
47 FrontBoardServices 0x000000010f59dba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
48 FrontBoardServices 0x000000010f59d860 -[FBSSerialQueue _performNext] + 457
49 FrontBoardServices 0x000000010f59de40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
50 CoreFoundation 0x0000000103630721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
51 CoreFoundation 0x000000010362ff93 __CFRunLoopDoSources0 + 243
52 CoreFoundation 0x000000010362a63f __CFRunLoopRun + 1263
53 CoreFoundation 0x0000000103629e11 CFRunLoopRunSpecific + 625
54 GraphicsServices 0x000000010c5b71dd GSEventRunModal + 62
55 UIKitCore 0x0000000108c8181d UIApplicationMain + 140
56 AppName 0x0000000100e8e794 main + 68
57 libdyld.dylib 0x0000000105500575 start + 1
)
I really have no clue what it could be. Tried setting a symbolic breakpoint at [UIViewController _loadViewFromNibNamed:bundle:] but that didn't really give any useful insight. Hope someone can help. I should also mention the only thing I'm doing in AppDelegate is instantiating firebase.
Helpful guy over at reddit figured it out for me. Didn't realize but there was an init() function on my initial view controller that the last guy made which checked the internet connection and redirected to a different page if there wasn't one.
I'm dealing with a weird crash which I didn't find a solution yet for.
The title of the crash in Organizer is UIKit: __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 316 and the whole stacktrace is below.
I've checked the startController(_:) method from AppDelegate and everything seems to be fine. Is it a constraint issue maybe? What else could it be?
Last Exception Backtrace:
0 CoreFoundation 0x1d57bb38 __exceptionPreprocess + 124 (NSException.m:165)
1 libobjc.A.dylib 0x1c803062 objc_exception_throw + 34 (objc-exception.mm:521)
2 CoreFoundation 0x1d580fcc -[NSObject(NSObject) doesNotRecognizeSelector:] + 118 (NSObject.m:328)
3 CoreFoundation 0x1d57f0be ___forwarding___ + 692 (NSForwarding.m:3126)
4 CoreFoundation 0x1d4a7dc4 _CF_forwarding_prep_0 + 20
5 Foundation 0x1ded2b76 -[NSLayoutAnchor nsli_lowerIntoExpression:withCoefficient:forConstraint:] + 498 (NSLayoutAnchor.m:883)
6 Foundation 0x1de1b142 -[NSLayoutConstraint _lowerIntoExpression:reportingConstantIsRounded:] + 104 (NSLayoutConstraint.m:1723)
7 Foundation 0x1de1addc -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 120 (NSLayoutConstraint.m:1606)
8 Foundation 0x1de265b4 -[NSLayoutConstraint _addToEngine:] + 24 (NSLayoutConstraint.m:1621)
9 UIKit 0x228a88b2 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 316 (NSLayoutConstraint_UIKitAdditions.m:3596)
10 Foundation 0x1de1a97e -[NSISEngine withBehaviors:performModifications:] + 258 (NSISEngine.m:1973)
11 UIKit 0x228a873a __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 502 (NSLayoutConstraint_UIKitAdditions.m:3585)
12 UIKit 0x227aa5e8 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 216 (NSLayoutConstraint_UIKitAdditions.m:3550)
13 UIKit 0x228e3654 -[UIView(AdditionalLayoutSupport) _initializeHostedLayoutEngine] + 486 (NSLayoutConstraint_UIKitAdditions.m:3333)
14 UIKit 0x228afe20 -[UIView(UIConstraintBasedLayout) _layoutEngine_windowDidChange] + 120 (NSLayoutConstraint_UIKitAdditions.m:563)
15 UIKit 0x227aa6e0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 208 (UIView.m:12461)
16 UIKit 0x227a9ee0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 120 (UIView.m:9478)
17 UIKit 0x227a9d6c -[UIView(Hierarchy) _postMovedFromSuperview:] + 710 (UIView.m:361)
18 UIKit 0x227b527a -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1636 (UIView.m:13256)
19 UIKit 0x227b4bfe -[UIView(Hierarchy) addSubview:] + 726 (UIView.m:9004)
20 UIKit 0x227b420c -[UIWindow addRootViewControllerViewIfPossible] + 506 (UIWindow.m:1498)
21 UIKit 0x227b15b6 -[UIWindow _setHidden:forced:] + 282 (UIWindow.m:1572)
22 UIKit 0x22821154 -[UIWindow makeKeyAndVisible] + 38 (UIWindow.m:4934)
23 MyApp 0x1c3f28 AppDelegate.startController(_:) + 978 (AppDelegate.swift:207)
24 MyApp 0x1cad3c specialized AppDelegate.application(_:didFinishLaunchingWithOptions:) + 3082 (AppDelegate.swift:141)
25 MyApp 0x1c3a18 #objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 152 (<compiler-generated>:0)
26 UIKit 0x2281d5c0 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 372 (UIApplication.m:1797)
27 UIKit 0x22a1ea46 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3702 (UIApplication.m:2129)
28 UIKit 0x22a23c18 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1636 (UIApplication.m:3625)
29 UIKit 0x22a367c0 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3149 + 36 (UIApplication.m:10365)
30 UIKit 0x22a21356 -[UIApplication workspaceDidEndTransaction:] + 138 (UIApplication.m:2989)
31 FrontBoardServices 0x1ee5cc0e __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 14 (FBSSerialQueue.m:158)
32 FrontBoardServices 0x1ee5cac8 -[FBSSerialQueue _performNext] + 216 (FBSSerialQueue.m:177)
33 FrontBoardServices 0x1ee5cdb2 -[FBSSerialQueue _performNextFromRunLoopSource] + 40 (FBSSerialQueue.m:206)
34 CoreFoundation 0x1d537fd8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8 (CFRunLoop.c:1941)
35 CoreFoundation 0x1d537b00 __CFRunLoopDoSources0 + 420 (CFRunLoop.c:1989)
36 CoreFoundation 0x1d535f4c __CFRunLoopRun + 1156 (CFRunLoop.c:2821)
37 CoreFoundation 0x1d4891aa CFRunLoopRunSpecific + 466 (CFRunLoop.c:3113)
38 CoreFoundation 0x1d488fcc CFRunLoopRunInMode + 100 (CFRunLoop.c:3143)
39 UIKit 0x22816e28 -[UIApplication _run] + 656 (UIApplication.m:2658)
40 UIKit 0x22811a4e UIApplicationMain + 146 (UIApplication.m:4089)
41 MyApp 0x68564 main + 32 (HighlightsDetailViewController.swift:62)
42 libdyld.dylib 0x1cc764e6 _dyld_process_info_notify_release + 26 (dyld_process_info_notify.cpp:327)
Thanks in advance!
I finally solved the problem. Shortly, the crash appeared only on iOS 10.x devices, because some of my .xib files had had set a later version of iOS (11.0 i.e.) in "File Inspector -> Interface Builder Document -> Builds for" instead of the default Deployment Target set in the project settings, which was 10.x of course.
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Application windows are expected to have a root view controller at the end of application launch
Native stack trace:
0 CoreFoundation 0x0000000104e4d1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000112c18031 objc_exception_throw + 48
2 CoreFoundation 0x0000000104e52472 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000105a7d652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x0000000109bd4b96 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3064
5 UIKit 0x0000000109f96e4a __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
6 UIKit 0x000000010a369909 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
7 UIKit 0x0000000109f96a86 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
8 UIKit 0x0000000109f972a7 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
9 UIKit 0x000000010a9084d4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
10 UIKit 0x000000010a90836e -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
11 UIKit 0x000000010a5ec62d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
12 UIKit 0x000000010a7e7387 _performActionsWithDelayForTransitionContext + 100
13 UIKit 0x000000010a5ec4f7 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
14 UIKit 0x000000010a368fb0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
15 UIKit 0x0000000109bd2f0c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
16 UIKit 0x000000010a1a5a97 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
17 FrontBoardServices 0x0000000117f362f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
18 FrontBoardServices 0x0000000117f3ecfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
19 libdispatch.dylib 0x000000011356f779 _dispatch_client_callout + 8
20 libdispatch.dylib 0x0000000113574931 _dispatch_block_invoke_direct + 317
21 FrontBoardServices 0x0000000117f6a470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
22 FrontBoardServices 0x0000000117f6a12e -[FBSSerialQueue _performNext] + 439
23 FrontBoardServices 0x0000000117f6a68e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
24 CoreFoundation 0x0000000104defbb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25 CoreFoundation 0x0000000104dd44af __CFRunLoopDoSources0 + 271
26 CoreFoundation 0x0000000104dd3a6f __CFRunLoopRun + 1263
27 CoreFoundation 0x0000000104dd330b CFRunLoopRunSpecific + 635
28 GraphicsServices 0x00000001165faa73 GSEventRunModal + 62
29 UIKit 0x0000000109bd60b7 UIApplicationMain + 159
30 ??? 0x0000000133339607 0x0 + 5153986055
31 ??? 0x0000000133339373 0x0 + 5153985395
If you are having this error when using Xamarin Forms you should probably check if your initial page is properly constructed. This happens when XF fails to create your initial page and just continues running.
I was trying to add a tool bar at the bottom of UITableView which is> successfully added. But when i connect the bar button with IBAction,
on loading of that view controller app just crashes. Without linking
to IbAction app works fine.
I am using xCode 9.2
Here is my storyboard.
Here is the crash log.
2018-04-11 11:11:38.636121+0500 SafeBolt[9610:88848] *** Assertion failure in -[_UINavigationBarVisualProviderModernIOS _contentViewFittingHeight], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.33.6/_UINavigationBarVisualProviderModernIOS.m:569
2018-04-11 11:11:38.662356+0500 SafeBolt[9610:88848] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Sigh. Contentview size is zero.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001072b612b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001063fdf41 objc_exception_throw + 48
2 CoreFoundation 0x00000001072bb2f2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000105e9ed69 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x00000001085d22f5 -[_UINavigationBarVisualProviderModernIOS _contentViewFittingHeight] + 265
5 UIKit 0x00000001083505e0 -[UINavigationItem _desiredHeightForBarMetrics:defaultHeightBlock:] + 90
6 UIKit 0x00000001085d4fa1 -[_UINavigationBarVisualProviderModernIOS heightRangeFittingWidth:] + 412
7 UIKit 0x0000000107ae40ed -[UINavigationBar _heightRangeForNavigationItem:fittingWidth:] + 210
8 UIKit 0x0000000107bc0a98 -[UINavigationController _intrinsicNavigationBarHeightRangeForViewController:] + 187
9 UIKit 0x0000000107bc09b6 -[UINavigationController _preferredHeightForHidingNavigationBarForViewController:] + 628
10 UIKit 0x0000000107bb088f -[UINavigationController _positionNavigationBarHidden:edge:initialOffset:] + 356
11 UIKit 0x0000000107bb0cf8 -[UINavigationController _positionNavigationBarHidden:edge:] + 388
12 UIKit 0x0000000107bb8555 -[UINavigationController loadView] + 243
13 UIKit 0x0000000107b7b05c -[UIViewController loadViewIfRequired] + 195
14 UIKit 0x0000000107b7b8b9 -[UIViewController view] + 27
15 iOS_Slide_Menu 0x00000001054bbe5a -[SlideNavigationController setEnableShadow:] + 74
16 iOS_Slide_Menu 0x00000001054b9804 -[SlideNavigationController setup] + 244
17 iOS_Slide_Menu 0x00000001054b9541 -[SlideNavigationController initWithCoder:] + 145
18 UIKit 0x0000000107e644c8 -[UIClassSwapper initWithCoder:] + 246
19 UIKit 0x00000001080b9109 UINibDecoderDecodeObjectForValue + 704
20 UIKit 0x00000001080b8e3e -[UINibDecoder decodeObjectForKey:] + 89
21 UIKit 0x0000000107ae075a -[UINavigationBar initWithCoder:] + 753
22 UIKit 0x00000001080b9109 UINibDecoderDecodeObjectForValue + 704
23 UIKit 0x00000001080b8e3e -[UINibDecoder decodeObjectForKey:] + 89
24 UIKit 0x000000010834b5f2 -[UINavigationItem initWithCoder:] + 1018
25 UIKit 0x00000001080b9109 UINibDecoderDecodeObjectForValue + 704
26 UIKit 0x00000001080b8e3e -[UINibDecoder decodeObjectForKey:] + 89
27 UIKit 0x0000000107b76053 -[UIViewController initWithCoder:] + 432
28 SafeBolt 0x000000010448dfa2 _T08SafeBolt18BaseViewControllerCACSgSo7NSCoderC5coder_tcfc + 66
29 SafeBolt 0x000000010446db83 _T08SafeBolt26EmailListingViewControllerCACSgSo7NSCoderC5coder_tcfc + 1315
30 SafeBolt 0x000000010446dc4f _T08SafeBolt26EmailListingViewControllerCACSgSo7NSCoderC5coder_tcfcTo + 47
31 UIKit 0x0000000107e644c8 -[UIClassSwapper initWithCoder:] + 246
32 UIKit 0x00000001080b9109 UINibDecoderDecodeObjectForValue + 704
33 UIKit 0x00000001080b8e3e -[UINibDecoder decodeObjectForKey:] + 89
34 UIKit 0x0000000107e64194 -[UIRuntimeConnection initWithCoder:] + 178
35 UIKit 0x0000000107e648d0 -[UIRuntimeEventConnection initWithCoder:] + 59
36 UIKit 0x00000001080b9109 UINibDecoderDecodeObjectForValue + 704
37 UIKit 0x00000001080b92a7 UINibDecoderDecodeObjectForValue + 1118
38 UIKit 0x00000001080b8e3e -[UINibDecoder decodeObjectForKey:] + 89
39 UIKit 0x0000000107e63391 -[UINib instantiateWithOwner:options:] + 1262
40 UIKit 0x00000001082f3fc2 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
41 SafeBolt 0x000000010448eda2 _T08SafeBolt11AppDelegateC23setUpRootViewControlleryyF + 386
42 SafeBolt 0x000000010448f6b5 _T08SafeBolt11AppDelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0F16LaunchOptionsKeyVypGSg022didFinishLaunchingWithI0tF + 101
43 SafeBolt 0x000000010448f79a _T08SafeBolt11AppDelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0F16LaunchOptionsKeyVypGSg022didFinishLaunchingWithI0tFTo + 186
44 UIKit 0x00000001079cabca -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 299
45 UIKit 0x00000001079cc648 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4113
46 UIKit 0x00000001079d1aeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
47 UIKit 0x0000000107d9b6f8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
48 UIKit 0x00000001081714c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
49 UIKit 0x0000000107d9b2f1 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
50 UIKit 0x0000000107d9bb6b -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696
51 UIKit 0x0000000108719a69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
52 UIKit 0x0000000108719922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
53 UIKit 0x00000001083f69c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
54 UIKit 0x00000001085f5b06 _performActionsWithDelayForTransitionContext + 100
55 UIKit 0x00000001083f688b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
56 UIKit 0x0000000108170b25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
57 UIKit 0x00000001079d036a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
58 UIKit 0x0000000107fab605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
59 FrontBoardServices 0x000000010d340cc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
60 FrontBoardServices 0x000000010d3497b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
61 libdispatch.dylib 0x000000010af5933d _dispatch_client_callout + 8
62 libdispatch.dylib 0x000000010af5e9f3 _dispatch_block_invoke_direct + 592
63 FrontBoardServices 0x000000010d375498 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
64 FrontBoardServices 0x000000010d37514e -[FBSSerialQueue _performNext] + 464
65 FrontBoardServices 0x000000010d3756bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
66 CoreFoundation 0x0000000107259101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
67 CoreFoundation 0x00000001072f8f71 __CFRunLoopDoSource0 + 81
68 CoreFoundation 0x000000010723da19 __CFRunLoopDoSources0 + 185
69 CoreFoundation 0x000000010723cfff __CFRunLoopRun + 1279
70 CoreFoundation 0x000000010723c889 CFRunLoopRunSpecific + 409
71 GraphicsServices 0x000000010dcb79c6 GSEventRunModal + 62
72 UIKit 0x00000001079d35d6 UIApplicationMain + 159
73 SafeBolt 0x0000000104490d27 main + 55
74 libdyld.dylib 0x000000010afd5d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Here is the code for IbAction.
#IBAction func testAction(_ sender: UIBarButtonItem) {
}
Any help would be appreciated.
Please try the following steps in order to solve this issue. Also let me know if it doesn't work for you.
Select the item in storyboard for which you are trying to add IBAction
Check in the connection inspector and see if there are still some extra connections other then the required one.
If there are other extra connections delete them and compile your code again. It should work.
This error usually happens when you create connections and deletes the code from your controller but your connection still exists.
In my iOS app there is a view with a tableview inside. The table cells are loaded from a PHP file on a remote server. I have also put a NSTimer on the view controller that should reload the data.
The cells contain information that may change on a time interval. That is working fine only if the number of cells doesn't change on a time interval. If a cell is added on a time interval, then the app crashes.
This is the code for the NSTimer:
self.timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:#selector(refrescar) userInfo:nil repeats:YES];
And this is the code for the method refrescar:
- (void)refrescar {
total_actual =0;
total =0;
[self viewDidLoad];
}
I have also tried with this one:
- (void)refrescar {
total_actual =0;
total =0;
[self.tableView reloadData];
}
But the app crashes as with the other code with [self viewDidLoad];
Any help is welcome.
Error log:
2014-11-13 23:52:23.299 RestAppXXI[1552:607] -[NSNull length]: unrecognized selector sent to instance 0xcb6068
2014-11-13 23:52:23.429 RestAppXXI[1552:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0xcb6068'
*** First throw call stack:
(
0 CoreFoundation 0x00b6a1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x031588e5 objc_exception_throw + 44
2 CoreFoundation 0x00c07243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x00b5a50b ___forwarding___ + 1019
4 CoreFoundation 0x00b5a0ee _CF_forwarding_prep_0 + 14
5 UIKit 0x01fd2cc7 -[UILabel _textRectForBounds:limitedToNumberOfLines:includingShadow:] + 57
6 UIKit 0x01fd2b13 -[UILabel textRectForBounds:limitedToNumberOfLines:] + 85
7 UIKit 0x01fd662e -[UILabel _intrinsicSizeWithinSize:] + 173
8 UIKit 0x01fd6751 -[UILabel intrinsicContentSize] + 91
9 UIKit 0x024b07ef -[UIView(UIConstraintBasedLayout) _generateContentSizeConstraints] + 36
10 UIKit 0x024b0480 -[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] + 511
11 UIKit 0x024b67bf -[UIView(AdditionalLayoutSupport) updateConstraints] + 110
12 UIKit 0x01fd6579 -[UILabel updateConstraints] + 189
13 UIKit 0x024b6058 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 239
14 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
15 UIKit 0x024b6157 __UIViewRecursionHelper + 40
16 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
17 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
18 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
19 UIKit 0x024b6157 __UIViewRecursionHelper + 40
20 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
21 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
22 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
23 UIKit 0x024b6157 __UIViewRecursionHelper + 40
24 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
25 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
26 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
27 UIKit 0x024b6157 __UIViewRecursionHelper + 40
28 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
29 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
30 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
31 UIKit 0x024b6157 __UIViewRecursionHelper + 40
32 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
33 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
34 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
35 UIKit 0x024b6157 __UIViewRecursionHelper + 40
36 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
37 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
38 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
39 UIKit 0x024b6157 __UIViewRecursionHelper + 40
40 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
41 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
42 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
43 UIKit 0x024b6157 __UIViewRecursionHelper + 40
44 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
45 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
46 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
47 UIKit 0x024b6157 __UIViewRecursionHelper + 40
48 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
49 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
50 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
51 UIKit 0x024b6157 __UIViewRecursionHelper + 40
52 CoreFoundation 0x00b0bc69 CFArrayApplyFunction + 57
53 UIKit 0x024b5ffc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 147
54 UIKit 0x024b61d6 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
55 UIKit 0x024aa878 __62-[UIWindow(UIConstraintBasedLayout) updateConstraintsIfNeeded]_block_invoke + 43
56 Foundation 0x02f0b68c -[NSISEngine withBehaviors:performModifications:] + 107
57 Foundation 0x02d9b3c5 -[NSISEngine withAutomaticOptimizationDisabled:] + 48
58 UIKit 0x024aa590 -[UIWindow(UIConstraintBasedLayout) updateConstraintsIfNeeded] + 225
59 UIKit 0x024aa467 -[UIWindow(UIConstraintBasedLayout) layoutSublayersOfLayer:] + 90
60 libobjc.A.dylib 0x0316a82b -[NSObject performSelector:withObject:] + 70
61 QuartzCore 0x0171a45a -[CALayer layoutSublayers] + 148
62 QuartzCore 0x0170e244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
63 QuartzCore 0x0170e0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
64 QuartzCore 0x016747fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
65 QuartzCore 0x01675b85 _ZN2CA11Transaction6commitEv + 393
66 QuartzCore 0x01676258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
67 CoreFoundation 0x00b3236e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
68 CoreFoundation 0x00b322bf __CFRunLoopDoObservers + 399
69 CoreFoundation 0x00b10254 __CFRunLoopRun + 1076
70 CoreFoundation 0x00b0f9d3 CFRunLoopRunSpecific + 467
71 CoreFoundation 0x00b0f7eb CFRunLoopRunInMode + 123
72 GraphicsServices 0x041945ee GSEventRunModal + 192
73 GraphicsServices 0x0419442b GSEventRun + 104
74 UIKit 0x01e18f9b UIApplicationMain + 1225
75 RestAppXXI 0x000305ed main + 141
76 libdyld.dylib 0x049eb6d9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
That is not relevant to your UITableView. That is most probably from a string you are trying to access, but it's nil.
User exception break point to debug, you are calling length method on NSNull object
And why to use NSTimer, you can reload table after getting response from server