Crashing iOS app after creating a new view - ios

I'm just starting to learn creating iOS apps and so I'm just a noob in it. Especially because of the different approach it has on handling navigation and interaction between UI and Code. :)
Ok I'm using xCode 5 with SDK version 7. I created a single view application and it gave me a .storyboard file which I guess replaces the .xib which used to be there when I watch tutorial videos.
So I designed a simple UI as the main view and now I want to have another view as the landing view. So it should come in before the main view. I went ahead and from New File... I created an Objective-C class which is a subclass of UIViewController and named it Detail. Surprisingly it gave me a .xib file again. Fair enough. Then I just put a simple input in the UI to just preview it.
Then from Project Settings, in the General tab, I changed the Main Interface to match the new .xib file I created. But when I launched the application, it crashed and I don't know what the problem is.
Here is the stack trace:
2013-11-27 18:31:21.735 TestViewSwitching[10123:70b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x8b35dc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** First throw call stack:
(
0 CoreFoundation 0x0174c5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014bb8b6 objc_exception_throw + 44
2 CoreFoundation 0x017dc6a1 -[NSException raise] + 17
3 Foundation 0x0117c9ee -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x010e8cfb _NSSetUsingKeyValueSetter + 88
5 Foundation 0x010e8253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x0114a70a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x004cba15 -[UIRuntimeOutletConnection connect] + 106
8 libobjc.A.dylib 0x014cd7d2 -[NSObject performSelector:] + 62
9 CoreFoundation 0x01747b6a -[NSArray makeObjectsPerformSelector:] + 314
10 UIKit 0x004ca56e -[UINib instantiateWithOwner:options:] + 1417
11 UIKit 0x004cc2fb -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 165
12 UIKit 0x002293bb -[UIApplication _loadMainNibFileNamed:bundle:] + 58
13 UIKit 0x002296e9 -[UIApplication _loadMainInterfaceFile] + 245
14 UIKit 0x0022828f -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 543
15 UIKit 0x0023c87c -[UIApplication handleEvent:withNewEvent:] + 3447
16 UIKit 0x0023cde9 -[UIApplication sendEvent:] + 85
17 UIKit 0x0022a025 _UIApplicationHandleEvent + 736
18 GraphicsServices 0x036df2f6 _PurpleEventCallback + 776
19 GraphicsServices 0x036dee01 PurpleEventCallback + 46
20 CoreFoundation 0x016c7d65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
21 CoreFoundation 0x016c7a9b __CFRunLoopDoSource1 + 523
22 CoreFoundation 0x016f277c __CFRunLoopRun + 2156
23 CoreFoundation 0x016f1ac3 CFRunLoopRunSpecific + 467
24 CoreFoundation 0x016f18db CFRunLoopRunInMode + 123
25 UIKit 0x00227add -[UIApplication _run] + 840
26 UIKit 0x00229d3b UIApplicationMain + 1225
27 TestViewSwitching 0x0000211d main + 141
28 libdyld.dylib 0x01d7670d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
This process in Android is pretty straight forward, but I don't know why Apple tries to make everything harder for developers. They couldn't just set up a type which generates a new view ready to go?

#Miro Markarian , you may check the .xib file for view outlet.It may be be disconnected or broken.This issue generally arises due to that.Try to add the outlet of the view controller's view to the .xib view.

Your view outlet on your main view controller's .xib is not connected to its file owner properly.

Related

how to find related code by call stack in xcode?

there,
I'm new to ios, and get a crash log as follows.
my question is, what does the "+ 373" mean in "[ICLRootViewController addHomeScreenViewController] + 373"? how to find related line in ICLRootViewController.m? Line 373 has no relationship with function addHomeScreenViewController() at all.
2017-02-09 16:23:28.117 Demo[98834:4764956] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't find view controller.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000111f77d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000110dfb21e objc_exception_throw + 48
2 CoreFoundation 0x0000000111f7be42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010cda066d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 Demo 0x0000000109bb63c5 -[ICLRootViewController addHomeScreenViewController] + 373
5 Demo 0x0000000109bc252e -[ICLRootViewController onNewsButtonClicked] + 542
6 Demo 0x0000000109a2b9ce __51-[ICLHomeScreenToolbarViewController initWebToolbar]_block_invoke_2 + 62
7 Demo 0x0000000109dee0f1 -[ICLWebViewToolbar didClickNewsButton:] + 305
8 UIKit 0x000000010f5b18bc -[UIApplication sendAction:to:from:forEvent:] + 83
9 UIKit 0x000000010f737c38 -[UIControl sendAction:to:forEvent:] + 67
10 UIKit 0x000000010f737f51 -[UIControl _sendActionsForEvents:withEvent:] + 444
11 UIKit 0x000000010f736e4d -[UIControl touchesEnded:withEvent:] + 668
12 UIKit 0x000000010f61f545 -[UIWindow _sendTouchesForEvent:] + 2747
13 UIKit 0x000000010f620c33 -[UIWindow sendEvent:] + 4011
14 Demo 0x0000000109a96a80 -[ICLInteractionDetectionWindow sendEvent:] + 688
15 UIKit 0x000000010f5cd9ab -[UIApplication sendEvent:] + 371
16 UIKit 0x000000010fdba72d __dispatchPreprocessedEventFromEventQueue + 3248
17 UIKit 0x000000010fdb3463 __handleEventQueue + 4879
18 CoreFoundation 0x0000000111f1c761 __CFRUNLOICL_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19 CoreFoundation 0x0000000111f0198c __CFRunLoopDoSources0 + 556
20 CoreFoundation 0x0000000111f00e76 __CFRunLoopRun + 918
21 CoreFoundation 0x0000000111f00884 CFRunLoopRunSpecific + 420
22 GraphicsServices 0x000000011473ba6f GSEventRunModal + 161
23 UIKit 0x000000010f5afc68 UIApplicationMain + 159
24 Demo 0x000000010981da1f main + 111
25 libdyld.dylib 0x0000000113ccd68d start + 1
thanks a lot!
373 is an offset from the beginning of the function symbol listed in the backtrace. The crash reporter didn't have access to debug information so it couldn't do the translation from address to source lines.
If you have the binary that is exhibiting this crash and it's dSYM, however, you can figure this out by hand. You won't be able to tell anything from the absolute addresses in the crash, since macOS and iOS randomize load locations. That's why having it in "symbol + offset" form is handy. So, load your binary & dSYM into the debugger and do:
(lldb) disassemble -m -n "-[ICLRootViewController addHomeScreenViewController]"
That command will disassemble the code for the function passed to the -n argument, showing a mixed source & assembly view of this method. The assembly output will be listed with the offsets, so just find <+373> and the source lines above it will show you where it comes from. If this is optimized code, the source -> address mapping can sometimes be confusing, but the mixed view might help you sort that out as well.
perhaps you can find the answer in the 4th line displaying,
4 Demo 0x0000000109bb63c5 -[ICLRootViewController addHomeScreenViewController] + 373
where is the last code in your project that run

iOS 9 push segue is causing my app to crash

In iOS 8.4, simulator and phone, I experience no issue with my performSegue call, but when using the simulator on Xcode 7 beta 5, when the performSegue call is made, it crashes. The call stack is below.
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM insertObject:atIndex:]: index 3 beyond bounds [0 .. 1]'
*** First throw call stack:
(
0 CoreFoundation 0x00000001137509b5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001131c8deb objc_exception_throw + 48
2 CoreFoundation 0x00000001136179d5 -[__NSArrayM insertObject:atIndex:] + 901
3 Foundation 0x0000000110c42aa1 -[NSKeyValueSlowMutableArray insertObject:atIndex:] + 106
4 CoreFoundation 0x000000011366beb2 -[NSMutableArray insertObjects:count:atIndex:] + 162
5 CoreFoundation 0x000000011366bc1f -[NSMutableArray insertObjectsFromArray:range:atIndex:] + 335
6 CoreFoundation 0x000000011366baa3 -[NSMutableArray addObjectsFromArray:] + 723
7 UIKit 0x00000001119ef467 -[UIRuntimeOutletCollectionConnection performConnect] + 860
8 CoreFoundation 0x0000000113691590 -[NSArray makeObjectsPerformSelector:] + 224
9 UIKit 0x000000011173ccaa -[UINib instantiateWithOwner:options:] + 1864
10 UIKit 0x0000000111531df4 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
11 UIKit 0x0000000111532720 -[UIViewController loadView] + 178
12 UIKit 0x0000000111532a22 -[UIViewController loadViewIfRequired] + 138
13 UIKit 0x0000000111538e33 -[UIViewController __viewWillAppear:] + 120
14 UIKit 0x0000000111565cba -[UINavigationController _startCustomTransition:] + 1177
15 UIKit 0x00000001115752f7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 712
16 UIKit 0x00000001115761ad -[UINavigationController __viewWillLayoutSubviews] + 57
17 UIKit 0x00000001117082d1 -[UILayoutContainerView layoutSubviews] + 248
18 UIKit 0x0000000111459a3b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710
19 QuartzCore 0x00000001110f336a -[CALayer layoutSublayers] + 146
20 QuartzCore 0x00000001110e7bd0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
21 QuartzCore 0x00000001110e7a4e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
22 QuartzCore 0x00000001110dc1d5 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
23 QuartzCore 0x00000001111099f0 _ZN2CA11Transaction6commitEv + 508
24 UIKit 0x00000001113d5eb0 _afterCACommitHandler + 174
25 CoreFoundation 0x000000011367c457 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
26 CoreFoundation 0x000000011367c3c7 __CFRunLoopDoObservers + 391
27 CoreFoundation 0x000000011367201b __CFRunLoopRun + 1147
28 CoreFoundation 0x0000000113671918 CFRunLoopRunSpecific + 488
29 GraphicsServices 0x0000000115ee3ad2 GSEventRunModal + 161
30 UIKit 0x00000001113ac99e UIApplicationMain + 171
31 MyApp 0x000000010fbfe59f main + 111
32 libdyld.dylib 0x000000011429c92d start + 1
33 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
It doesn't look like it has anything to do with my code since it's happening during the transition and none of my own functions are in the call stack.
Has anybody experienced this, and/or know how to solve this? I put breakpoints in every function of my second view controller and none of them were hit.
I am sure this is bug. In my situation it was segue pointed to TabBarView.
performSegueWithIdentifier("tabSegue",sender: nil)
When it starts crashing(this happening times to times without changing sb) i just remove segue from storyboard and create it back. And it works.
Some people report that pointing a segue to ViewController instead of NavigationController fix the issue. You may try that option if it fits.
Source: https://forums.developer.apple.com/message/11153#11153
This issue is related to an invalid setup with Referencing Outlet Collections in a .xib file. for my particular project it was related to adding the same UIGestureRecognizer to the gestureRecognizer collection of multiple views. This worked prior to ios 9 but now crashes the program with an identical stack trace. If you know the view controller that causes the crash (and it sounds like you do because you're able to reproduce the crash), you should be able to see an error in the console telling you what is going on. If not I would examine each Referencing Outlet Collection in the .xib file and try to find the one that is causing the error.
It looks like a bug in the program instead of system. Please take a look at connection inspector to see if there is any unexpected outlet connection or broken outlet connection.
Fix for me: I was using custom segue for push. When i replaced custom segue with show segue issue fixed.
Looks like it was just an issue with Xcode. I still had the problem after installing the final release. I uninstalled Xcode and reinstalled from the App Store and didn't have the problem anymore. Thanks for all the suggested answers though! I've definitely had the issue of a bad segue in Storyboard before, but this time, it was just Xcode.

How to debug a main.m iOS app crash

I have integrated Crashlytics in my iOS app which is currently live on the App Store. In my latest update, I am seeing a lot of crashes with the stack trace as below.
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x30f6ef46 objc_msgSend + 5
1 UIKit 0x26665f07 -[UINavigationController viewWillAppear:] + 406
2 UIKit 0x265d5b1f -[UIViewController _setViewAppearState:isAnimating:] + 438
3 CoreFoundation 0x22fcf46d __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 48
4 CoreFoundation 0x22fc84c3 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 234
5 UIKit 0x265d5c9b -[UIViewController _setViewAppearState:isAnimating:] + 818
6 UIKit 0x2688c799 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 584
7 UIKit 0x26639bd9 _applyBlockToCFArrayCopiedToStack + 308
8 UIKit 0x265b5dd7 _afterCACommitHandler + 458
9 CoreFoundation 0x23069ffd __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
10 CoreFoundation 0x230676bb __CFRunLoopDoObservers + 278
11 CoreFoundation 0x23067ac3 __CFRunLoopRun + 914
12 CoreFoundation 0x22fb53b1 CFRunLoopRunSpecific + 476
13 CoreFoundation 0x22fb51c3 CFRunLoopRunInMode + 106
14 GraphicsServices 0x2a5a2201 GSEventRunModal + 136
15 UIKit 0x2661f43d UIApplicationMain + 1440
16 MyApp 0x00123553 main (main.m:16)
I recently added interstitial ads in my app and I believe the crash is related to that. But how can I get more information from this stack trace or from crashlytics to understand what is really going wrong?
Have you tried enabling Exception Breakpoints?
1) Inside Xcode, switch to the Breakpoints Navigator (left menu, seventh icon from left to right, it looks just like a breakpoint)
2) Click the + symbol in the lower left corner and choose "Add Exception Breakpoint"
3) Run and crash.
You should now be able to see what really caused the crash.

IOS7 app crashes in simulator when not in 64 bits, runs fine on iPhone4 and 5s

I am new here and new to iOS programming so bear with me!
I ran into this strange issue. I created an iPhone app which runs fine on my iPhone 5s and iPhone 4. However, when I run it on the iOS Simulator, Version 7.1 (463.9.41), it only runs in 64 bit mode and crashes for all the other modes.
Information based on your suggestions:
I renamed the property 'Description', with no changes and exactly the same error message including the word 'Description'. However, the word 'Description' is nowhere in my code anymore.
I cleared all contents in the ViewController and it still cranes.
All outlets and connections checked and OK.
Any idea what could be the cause?
* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Description.'
* First throw call stack:
0 CoreFoundation 0x018021e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015818e5 objc_exception_throw + 44
2 CoreFoundation 0x01891fe1 -[NSException raise] + 17
3 Foundation 0x01241d9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x011ae1d7 _NSSetUsingKeyValueSetter + 88
5 Foundation 0x011ad731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x0120fb0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x004f81f4 -[UIRuntimeOutletConnection connect] + 106
8 libobjc.A.dylib 0x015937de -[NSObject performSelector:] + 62
9 CoreFoundation 0x017fd76a -[NSArray makeObjectsPerformSelector:] + 314
10 UIKit 0x004f6d4d -[UINib instantiateWithOwner:options:] + 1417
11 UIKit 0x0035f6f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
12 UIKit 0x0035fe9d -[UIViewController loadView] + 302
13 UIKit 0x003600d3 -[UIViewController loadViewIfRequired] + 78
14 UIKit 0x003605d9 -[UIViewController view] + 35
15 UIKit 0x00280267 -[UIWindow addRootViewControllerViewIfPossible] + 66
16 UIKit 0x002805ef -[UIWindow _setHidden:forced:] + 312
17 UIKit 0x0028086b -[UIWindow _orderFrontWithoutMakingKey] + 49
18 UIKit 0x0028b3c8 -[UIWindow makeKeyAndVisible] + 65
19 UIKit 0x0023bbc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
20 UIKit 0x00240667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
21 UIKit 0x00254f92 -[UIApplication handleEvent:withNewEvent:] + 3517
22 UIKit 0x00255555 -[UIApplication sendEvent:] + 85
23 UIKit 0x00242250 _UIApplicationHandleEvent + 683
24 GraphicsServices 0x037f7f02 _PurpleEventCallback + 776
25 GraphicsServices 0x037f7a0d PurpleEventCallback + 46
26 CoreFoundation 0x0177dca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
27 CoreFoundation 0x0177d9db __CFRunLoopDoSource1 + 523
28 CoreFoundation 0x017a868c __CFRunLoopRun + 2156
29 CoreFoundation 0x017a79d3 CFRunLoopRunSpecific + 467
30 CoreFoundation 0x017a77eb CFRunLoopRunInMode + 123
31 UIKit 0x0023fd9c -[UIApplication _run] + 840
32 UIKit 0x00241f9b UIApplicationMain + 1225
33 Cards 0x0000c24d main + 141
34 libdyld.dylib 0x01e49701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Try to rename property Description to something else.
description is read only property of NSObject and some other objects and maybe it collides with your property.
Check your outlets for the Xibs or Storyboards, if one of them is not connected you will get this error. If you are using Key Value Coding then there is a wrong key name (check spelling).
I found the answer.
It happened after I changed the name of my project (top left in the xcode window). When you do this, Xcode asks if it also has to rename a couple of system files to which I answered "yes". After that, the name of my app is changed correctly, but crashes on the simulator unless it runs in 64 bit mode. On the iPhone it works fine in all cases.
Even when I leave all the all the item names unchanged except for the name of the app, the same things happens. When I change the name of the app back, all is OK.
I say it's a bug in Xcode.

iOS Thread 1: signal SIGABRT [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Okay,
I am relatively new to Objective-C. I am trying to build a basic Table View that will load data from my local server. The data load script works, by itself, however when I try to implement it with the Table View, the App crashes giving the Thread 1: signal SIGABRT error message. I try calling the retrieveData with nothing in it and it still crashes. This is probably a simple fix. Can someone please help.
2013-11-10 19:35:38.033 NewApp[4542:70b] -[TableViewController retreiveData]: unrecognized selector sent to instance 0x109265250
2013-11-10 19:35:38.036 NewApp[4542:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TableViewController retreiveData]: unrecognized selector sent to instance 0x109265250'
*** First throw call stack:
(
0 CoreFoundation 0x000000010188f795 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001015f2991 objc_exception_throw + 43
2 CoreFoundation 0x0000000101920bad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010188109d ___forwarding___ + 973
4 CoreFoundation 0x0000000101880c48 _CF_forwarding_prep_0 + 120
5 NewApp 0x00000001000020fb -[TableViewController viewDidLoad] + 107
6 UIKit 0x0000000100340fe4 -[UIViewController loadViewIfRequired] + 562
7 UIKit 0x00000001003411bd -[UIViewController view] + 29
8 UIKit 0x00000001002888c7 -[UIWindow addRootViewControllerViewIfPossible] + 58
9 UIKit 0x0000000100288bd5 -[UIWindow _setHidden:forced:] + 275
10 UIKit 0x0000000100291ca2 -[UIWindow makeKeyAndVisible] + 51
11 UIKit 0x00000001002500c8 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1449
12 UIKit 0x0000000100253be8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 660
13 UIKit 0x0000000100264aab -[UIApplication handleEvent:withNewEvent:] + 3092
14 UIKit 0x0000000100264f1e -[UIApplication sendEvent:] + 79
15 UIKit 0x00000001002552be _UIApplicationHandleEvent + 618
16 GraphicsServices 0x0000000103997bb6 _PurpleEventCallback + 762
17 GraphicsServices 0x000000010399767d PurpleEventCallback + 35
18 CoreFoundation 0x0000000101811819 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
19 CoreFoundation 0x00000001018115ee __CFRunLoopDoSource1 + 478
20 CoreFoundation 0x000000010183aab3 __CFRunLoopRun + 1939
21 CoreFoundation 0x0000000101839f33 CFRunLoopRunSpecific + 467
22 UIKit 0x00000001002534bd -[UIApplication _run] + 609
23 UIKit 0x0000000100255043 UIApplicationMain + 1010
24 NewApp 0x0000000100001fa3 main + 115
25 libdyld.dylib 0x0000000101f1e5fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
It seems to be quite simple, you call retreiveData, as you've pointed out, but according to the Objective-C runtime, no such method exists and thus the invocations fails and your app crashes. Make sure that the method actually exists (it probably is just a typo and you meant retrieveData?!)

Resources