Terminating app due to uncaught NSException of 'NSInvalidArgumentException' - swift

I have two Xcode projects (SampleMain, SampleTest) programmed in Swift which is taken into a single workspace called Sample. Then I try to merge SampleMain's UIStoryboard (Main) to SampleTest's UIStoryboard (Main) using a button via UIStoryboard reference. When I run the app no exception is caught until the button used for segue is pressed. As the button pressed the app is terminated with an NSException in the console log.
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a
view controller with identifier 'test'' * First throw call stack: ( 0
CoreFoundation 0x000000010e17334b exceptionPreprocess + 171 1
libobjc.A.dylib 0x000000010b5c021e objc_exception_throw + 48 2 UIKit
0x000000010c2622bf -[UIStoryboard instantiateInitialViewController] +
0 3 UIKit 0x000000010c048392 -[UIStoryboardViewControllerPlaceholder
initWithCoder:] + 143 4 UIKit 0x000000010c098dbd
UINibDecoderDecodeObjectForValue + 684 5 UIKit 0x000000010c098b0a
-[UINibDecoder decodeObjectForKey:] + 98 6 UIKit 0x000000010be9d15c -[UIRuntimeConnection initWithCoder:] + 178 7 UIKit 0x000000010c098dbd UINibDecoderDecodeObjectForValue + 684 8 UIKit 0x000000010c098f73
UINibDecoderDecodeObjectForValue + 1122 9 UIKit 0x000000010c098b0a
-[UINibDecoder decodeObjectForKey:] + 98 10 UIKit 0x000000010be9c300 -[UINib instantiateWithOwner:options:] + 1249 11 UIKit 0x000000010c2621ab -[UIStoryboard
instantiateViewControllerWithIdentifier:] + 181 12 UIKit
0x000000010c269fab -[UIStoryboardSegueTemplate
instantiateOrFindDestinationViewControllerWithSender:] + 90 13 UIKit
0x000000010c26a1ff -[UIStoryboardSegueTemplate _perform:] + 52 14
UIKit 0x000000010c26a4df -[UIStoryboardSegueTemplate perform:] + 156
15 UIKit 0x000000010ba91b88 -[UIApplication
sendAction:to:from:forEvent:] + 83 16 UIKit 0x000000010bc172b2
-[UIControl sendAction:to:forEvent:] + 67 17 UIKit 0x000000010bc175cb -[UIControl _sendActionsForEvents:withEvent:] + 444 18 UIKit 0x000000010bc164c7 -[UIControl touchesEnded:withEvent:] + 668 19 UIKit
0x000000010baff0d5 -[UIWindow _sendTouchesForEvent:] + 2747 20 UIKit
0x000000010bb007c3 -[UIWindow sendEvent:] + 4011 21 UIKit
0x000000010baada33 -[UIApplication sendEvent:] + 371 22 UIKit
0x000000010c29fb6d __dispatchPreprocessedEventFromEventQueue + 3248 23
UIKit 0x000000010c298817 __handleEventQueue + 4879 24 CoreFoundation
0x000000010e118311
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 25 CoreFoundation 0x000000010e0fd59c __CFRunLoopDoSources0 + 556 26
CoreFoundation 0x000000010e0fca86 __CFRunLoopRun + 918 27
CoreFoundation 0x000000010e0fc494 CFRunLoopRunSpecific + 420 28
GraphicsServices 0x000000011001ca6f GSEventRunModal + 161 29 UIKit
0x000000010ba8ff34 UIApplicationMain + 159 30 SampleMain
0x000000010afe4e2f main + 111 31 libdyld.dylib 0x000000010f09d68d
start + 1 ) libc++abi.dylib: terminating with uncaught exception of
type NSException (lldb)
I have configured the storyboard reference in the following manner:
SampleMain - Main.storyboard
What am I doing wrong? If my approach to merging two storyboards of two different projects is incorrect; please explain a method to do so.

Related

X code7 error trying to do PageViewController

In my main storyboard i have my firstViewController then secondViewController and my pageViewController is third.
I am connecting all of them using seque Modal.
First and Second is working but my third is showing me an error.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x7fb15bca4dd0>) doesn't contain a view controller with identifier 'FirstViewController''
*** First throw call stack:
(
0 CoreFoundation 0x0000000108ba7f65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010aa62deb objc_exception_throw + 48
2 UIKit 0x0000000109ccc5d4 -[UIStoryboard instantiateInitialViewController] + 0
3 0x00000001089b422d _TFC8test23SkillPageViewControllerP33_B1A346F97B9DE8BA73F8676576C06E1324newColoredViewControllerfS0_FSSCSo16UIViewController + 365
4 0x00000001089b65cc _TFFC8test23SkillPageViewControllerg22orderedViewControllersGSaCSo16UIViewController_U_FT_GSaS1__ + 92
5 0x00000001089b2f75 _TFC8test23SkillPageViewControllerg22orderedViewControllersGSaCSo16UIViewController_ + 325
6 0x00000001089b3229 _TFC8test23SkillPageViewController11viewDidLoadfS0_FT_T_ + 313
7 0x00000001089b35e2 _TToFC8test23SkillPageViewController11viewDidLoadfS0_FT_T_ + 34
8 UIKit 0x0000000109775931 -[UIViewController loadViewIfRequired] + 1344
9 UIKit 0x0000000109775c7d -[UIViewController view] + 27
10 UIKit 0x0000000109edbb2c -[_UIFullscreenPresentationController _setPresentedViewController:] + 87
11 UIKit 0x000000010974603a -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
12 UIKit 0x00000001097885c4 -[UIViewController _presentViewController:withAnimationController:completion:] + 3930
13 UIKit 0x000000010978b878 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 489
14 UIKit 0x000000010978b387 -[UIViewController presentViewController:animated:completion:] + 179
15 UIKit 0x0000000109ce2af3 __67-[UIStoryboardModalSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 243
16 UIKit 0x0000000109cd1189 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 460
17 UIKit 0x0000000109cd0f8c -[UIStoryboardSegueTemplate _perform:] + 82
18 UIKit 0x0000000109cd1250 -[UIStoryboardSegueTemplate perform:] + 156
19 UIKit 0x00000001095ec1fa -[UIApplication sendAction:to:from:forEvent:] + 92
20 UIKit 0x0000000109750504 -[UIControl sendAction:to:forEvent:] + 67
21 UIKit 0x00000001097507d0 -[UIControl _sendActionsForEvents:withEvent:] + 311
22 UIKit 0x000000010974f906 -[UIControl touchesEnded:withEvent:] + 601
23 UIKit 0x0000000109656aa3 -[UIWindow _sendTouchesForEvent:] + 835
24 UIKit 0x0000000109657691 -[UIWindow sendEvent:] + 865
25 UIKit 0x0000000109609752 -[UIApplication sendEvent:] + 263
26 UIKit 0x00000001095e4fcc _UIApplicationHandleEventQueue + 6693
27 CoreFoundation 0x0000000108ad40a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
28 CoreFoundation 0x0000000108ac9fcc __CFRunLoopDoSources0 + 556
29 CoreFoundation 0x0000000108ac9483 __CFRunLoopRun + 867
30 CoreFoundation 0x0000000108ac8e98 CFRunLoopRunSpecific + 488
31 GraphicsServices 0x000000010e099ad2 GSEventRunModal + 161
32 UIKit 0x00000001095ea676 UIApplicationMain + 171
33 0x00000001089ba10d main + 109
34 libdyld.dylib 0x000000010b58192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
It is a hard guess because you didn't provide any of you code, but as the error state,
You need to set identifier for the view controller you used,in Storyboard > ViewController(one you added to storyboard,I think it is FirstViewController)>attribute inspector
there something called storyboard identifier or something like this, you need to set it. as I see you need to name it "FirstViewController"
I think you are skipping some main steps of configuring a pageviewcontroller, there is a very good tutorial here
it would be very helpful, if you check this tutorial

SIGABRT Error swift

Could anyone help me understand why Im getting this error? It seems to be happening when I load one of my view controllers but I can't see why.
What usually causes an error like this?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextInputTraits length]: unrecognized selector sent to instance 0x7fbf924828a0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010664ac65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000105f27bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001066520ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001065a813c ___forwarding___ + 988
4 CoreFoundation 0x00000001065a7cd8 _CF_forwarding_prep_0 + 120
5 libswiftCore.dylib 0x0000000107ddf728 _TTSf4g_d___TFSSCfMSSFT12_cocoaStringPSs9AnyObject__SS + 120
6 libswiftCore.dylib 0x0000000107dc01a3 _TFSSCfMSSFT12_cocoaStringPSs9AnyObject__SS + 19
7 Project1 0x00000001054ec3bd _TToFC8ASA_Rank22SettingsViewControllers9ASANumberSS + 61
8 Foundation 0x0000000105abdb53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
9 CoreFoundation 0x0000000106592d50 -[NSArray makeObjectsPerformSelector:] + 224
10 UIKit 0x0000000106d1b4eb -[UINib instantiateWithOwner:options:] + 1506
11 UIKit 0x0000000106b736d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
12 UIKit 0x0000000106b73cc8 -[UIViewController loadView] + 109
13 UIKit 0x0000000106b73f39 -[UIViewController loadViewIfRequired] + 75
14 UIKit 0x0000000106b743ce -[UIViewController view] + 27
15 UIKit 0x000000010710132d -[_UIFullscreenPresentationController _setPresentedViewController:] + 65
16 UIKit 0x0000000106b4ed69 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 105
17 UIKit 0x0000000106b80248 -[UIViewController _presentViewController:withAnimationController:completion:] + 1761
18 UIKit 0x0000000106b826c1 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 132
19 UIKit 0x0000000106b825e5 -[UIViewController presentViewController:animated:completion:] + 229
20 UIKit 0x0000000106a44d62 -[UIApplication sendAction:to:from:forEvent:] + 75
21 UIKit 0x0000000106b5650a -[UIControl _sendActionsForEvents:withEvent:] + 467
22 UIKit 0x0000000106b558d9 -[UIControl touchesEnded:withEvent:] + 522
23 UIKit 0x0000000106a91958 -[UIWindow _sendTouchesForEvent:] + 735
24 UIKit 0x0000000106a92282 -[UIWindow sendEvent:] + 682
25 UIKit 0x0000000106a58541 -[UIApplication sendEvent:] + 246
26 UIKit 0x0000000106a65cdc _UIApplicationHandleEventFromQueueEvent + 18265
27 UIKit 0x0000000106a4059c _UIApplicationHandleEventQueue + 2066
28 CoreFoundation 0x000000010657e431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x00000001065742fd __CFRunLoopDoSources0 + 269
30 CoreFoundation 0x0000000106573934 __CFRunLoopRun + 868
31 CoreFoundation 0x0000000106573366 CFRunLoopRunSpecific + 470
32 GraphicsServices 0x000000010a1e0a3e GSEventRunModal + 161
33 UIKit 0x0000000106a438c0 UIApplicationMain + 1282
34 Project1 0x00000001054f70c7 main + 135
35 libdyld.dylib 0x0000000108530145 start + 1
36 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Please ask for any other informations that is helpful
Thanks
You most likely have an Outlet assigned to an element on the view controller you are transitioning to that is no longer connected to your code. This youtube video explains it in more detail.
To hunt down this issue, try right-clicking on all your elements (UILabels, UIViews, UIButton...) with the assistant editor open and cross check to see if the outlet name is referenced in the view controller.

popToViewController failed to pop to view error

I am using the following code:
#IBAction func popToRoot(sender:UIBarButtonItem){
navigationController.popToViewController(foodforteethViewController(), animated: false)
}
This function is linked with a custom back button and the h file is linked in the objective-c/swift bridging file. The issue with this is that I get an error as below:
2014-07-19 23:35:40.842 FoodForTeeth[9040:238499] * Assertion failure in -[UINavigationController popToViewController:transition:], /SourceCache/UIKit_Sim/UIKit-3232.3/UINavigationController.m:5345
2014-07-19 23:35:40.845 FoodForTeeth[9040:238499] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to get popped view controller.'
* First throw call stack:
(
0 CoreFoundation 0x00000001023ec995 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010209b9a3 objc_exception_throw + 45
2 CoreFoundation 0x00000001023ec7fa +[NSException raise:format:arguments:] + 106
3 Foundation 0x0000000101cc637f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 UIKit 0x0000000100b456b6 -[UINavigationController popToViewController:transition:] + 762
5 FoodForTeeth 0x00000001000272fe _TFC12FoodForTeeth9dietDiary9popToRootfS0_FCSo15UIBarButtonItemT_ + 302
6 FoodForTeeth 0x00000001000274f2 _TToFC12FoodForTeeth9dietDiary9popToRootfS0_FCSo15UIBarButtonItemT_ + 66
7 UIKit 0x00000001009f76b6 -[UIApplication sendAction:to:from:forEvent:] + 75
8 UIKit 0x00000001009f76b6 -[UIApplication sendAction:to:from:forEvent:] + 75
9 UIKit 0x0000000100af91c0 -[UIControl _sendActionsForEvents:withEvent:] + 467
10 UIKit 0x0000000100af858f -[UIControl touchesEnded:withEvent:] + 522
11 UIKit 0x0000000100a3c3b8 -[UIWindow _sendTouchesForEvent:] + 735
12 UIKit 0x0000000100a3cce3 -[UIWindow sendEvent:] + 683
13 UIKit 0x0000000100a0a1a1 -[UIApplication sendEvent:] + 246
14 UIKit 0x0000000100a1707a _UIApplicationHandleEventFromQueueEvent + 17591
15 UIKit 0x00000001009f3269 _UIApplicationHandleEventQueue + 1967
16 CoreFoundation 0x0000000102322a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
17 CoreFoundation 0x000000010231826d __CFRunLoopDoSources0 + 269
18 CoreFoundation 0x00000001023178a4 __CFRunLoopRun + 868
19 CoreFoundation 0x00000001023172d6 CFRunLoopRunSpecific + 470
20 GraphicsServices 0x0000000105475bbc GSEventRunModal + 161
21 UIKit 0x00000001009f6288 UIApplicationMain + 1282
22 FoodForTeeth 0x0000000100054db3 main + 115
23 libdyld.dylib 0x0000000102b45145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
What's going wrong?
you can not pop a view controller which is not in NavigationController stack.You should pop like this
if you want pop to rootViewController than there is direct method use this
#IBAction func popToRoot(sender:UIBarButtonItem){
self.navigationController.popToRootViewControllerAnimated(false)
}
Another way to go back to a specific view controller would be to use unwind segues:
What are Unwind segues for and how do you use them?

Whenever i run my application, the application crashes and it shows " signal1:Program recieved signal SIGABRT"

On the console it shows....
2011-09-29 17:06:39.564 Project AddressBook[925:207] * Terminating
app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Could not load NIB in bundle: 'NSBundle
(loaded)' with name 'eve''
* Call stack at first throw: ( 0 CoreFoundation
0x00e655a9 exceptionPreprocess + 185 1 libobjc.A.dylib
0x00fb9313 objc_exception_throw + 44 2 CoreFoundation
0x00e1def8 +[NSException raise:format:arguments:] + 136 3
CoreFoundation 0x00e1de6a +[NSException
raise:format:] + 58 4 UIKit
0x005500fa -[UINib instantiateWithOwner:options:] + 2024 5 UIKit
0x00551ab7 -[NSBundle(UINSBundleAdditions)
loadNibNamed:owner:options:] + 168 6 UIKit
0x00407628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70 7
UIKit 0x00405134 -[UIViewController
loadView] + 120 8 UIKit 0x0040500e
-[UIViewController view] + 56 9 UIKit
0x00406a3d -[UIViewController viewControllerForRotation] + 63 10
UIKit 0x00402988 -[UIViewController
_visibleView] + 90 11 UIKit 0x006a493c
-[UIClientRotationContext
initWithClient:toOrientation:duration:andWindow:] + 354 12 UIKit
0x0037c81e -[UIWindow
_setRotatableClient:toOrientation:updateStatusBar:duration:force:] +
954 13 UIKit 0x00604619
-[UIWindowController
transition:fromViewController:toViewController:target:didEndSelector:]
+ 1381 14 UIKit 0x0040965d
-[UIViewController presentModalViewController:withTransition:] + 3478
15 Project AddressBook 0x000032cb -[Home Events:] +
155 16 UIKit 0x003554fd
-[UIApplication sendAction:to:from:forEvent:] + 119 17 UIKit
0x003e5799 -[UIControl sendAction:to:forEvent:] + 67 18 UIKit
0x003e7c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] +
527 19 UIKit 0x003e67d8 -[UIControl
touchesEnded:withEvent:] + 458 20 UIKit
0x00379ded -[UIWindow _sendTouchesForEvent:] + 567 21 UIKit
0x0035ac37 -[UIApplication sendEvent:] + 447 22 UIKit
0x0035ff2e _UIApplicationHandleEvent + 7576 23 GraphicsServices
0x01723992 PurpleEventCallback + 1550 24 CoreFoundation
0x00e46944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
+ 52 25 CoreFoundation 0x00da6cf7
__CFRunLoopDoSource1 + 215 26 CoreFoundation
0x00da3f83 __CFRunLoopRun + 979 27 CoreFoundation
0x00da3840 CFRunLoopRunSpecific + 208 28 CoreFoundation
0x00da3761 CFRunLoopRunInMode + 97 29 GraphicsServices
0x017221c4 GSEventRunModal + 217 30 GraphicsServices
0x01722289 GSEventRun + 115 31 UIKit
0x00363c93 UIApplicationMain + 1160 32 Project AddressBook
0x00002828 main + 102 33 Project AddressBook
0x000027b9 start + 53 ) terminate called after throwing an instance of
'NSException' sharedlibrary apply-load-rules all Current language:
auto; currently objective
HELP ME PLEASE!!
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'eve''
Your problem is exactly this. You try to load a nib file named 'eve'.
Somewhere you call something like this:
VC *aVC = [[[VC alloc] initWithNibName:#"eve" bundle:nil] autorelease];
Xcode 4 should show you the call stack when it hits that exception. And in the source window it should show you the code where it happened. Three or four lines above that line is your problem.

Using the Tab bar results in an iPhone crash

I seem to be having an issue with loading a game on a tab in a tab bar application. When I run the app and click on the tab that the game is supposed to go on, it crashes giving me this in console:
2011-03-20 08:36:29.311 ComputerClan[21592:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x6948f30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key racquet_green.'
*** Call stack at first throw:
(
0 CoreFoundation 0x017ea5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0193e313 objc_exception_throw + 44
2 CoreFoundation 0x017ea4e1 -[NSException raise] + 17
3 Foundation 0x001a7677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x001a75e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0062b30c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x017608cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x00629d23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x0062bab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x004e1628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x004df134 -[UIViewController loadView] + 120
11 UIKit 0x004df00e -[UIViewController view] + 56
12 UIKit 0x004dd482 -[UIViewController contentScrollView] + 42
13 UIKit 0x004edf25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
14 UIKit 0x004ec555 -[UINavigationController _layoutViewController:] + 43
15 UIKit 0x004ed7aa -[UINavigationController _startTransition:fromViewController:toViewController:] + 326
16 UIKit 0x004e832a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
17 UIKit 0x004ef562 -[UINavigationController pushViewController:transition:forceImmediate:] + 932
18 UIKit 0x004e81c4 -[UINavigationController pushViewController:animated:] + 62
19 UIKit 0x004f469a -[UIMoreNavigationController pushViewController:animated:] + 105
20 UIKit 0x004a6b68 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
21 UIKit 0x0049cb05 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
22 Foundation 0x001ae79e __NSFireDelayedPerform + 441
23 CoreFoundation 0x017cb8c3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
24 CoreFoundation 0x017cce74 __CFRunLoopDoTimer + 1220
25 CoreFoundation 0x017292c9 __CFRunLoopRun + 1817
26 CoreFoundation 0x01728840 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x01728761 CFRunLoopRunInMode + 97
28 GraphicsServices 0x01dda1c4 GSEventRunModal + 217
29 GraphicsServices 0x01dda289 GSEventRun + 115
30 UIKit 0x0043dc93 UIApplicationMain + 1160
31 ComputerClan 0x00002b02 main + 84
32 ComputerClan 0x00002aa5 start + 53
)
terminate called after throwing an instance of 'NSException'
It seems as if you have a problem in the XIB you are trying to load. Make sure there are no invalid connections, i.e. connections to non-existent IBOutlets or IBActions. Also make sure you haven't defined any objects to be non-existent classes.