Unwind segue issue when navigating back to parent scene - ios

I'm trying to unwind segue form a scene. It works fine but I need to get a value to the parent screen. (I use the push segue to navigate from parent to child scene)
I'm calling the unwind segue like this
- (IBAction)done:(UIStoryboardSegue *)segue {
NSLog(#"gonna navigate");
RESTToppingTableViewController *vc = [segue destinationViewController];
[self setSelectedToppings:[vc toppingList]];
NSLog(#"%#", [vc toppingList]);
}
But the issue is, it seems the toppingList array is removed from memory even before the parent view is called.
Below is the error I got.
2013-12-06 13:26:42.192 Pizza to Go[2319:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RESTAddToCartViewController toppingList]: unrecognized selector sent to instance 0x9b681a0'
*** First throw call stack:
(
0 CoreFoundation 0x01f405e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01cc38b6 objc_exception_throw + 44
2 CoreFoundation 0x01fdd903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01f3090b ___forwarding___ + 1019
4 CoreFoundation 0x01f304ee _CF_forwarding_prep_0 + 14
5 Pizza to Go 0x0004a3a2 -[RESTAddToCartViewController done:] + 130
6 libobjc.A.dylib 0x01cd581f -[NSObject performSelector:withObject:] + 70
7 UIKit 0x010d01f1 -[UIStoryboardUnwindSegueTemplate _perform:] + 536
8 UIKit 0x00f660f9 -[UIStoryboardSegueTemplate perform:] + 115
9 libobjc.A.dylib 0x01cd5874 -[NSObject performSelector:withObject:withObject:] + 77
10 UIKit 0x00a330c2 -[UIApplication sendAction:to:from:forEvent:] + 108
11 UIKit 0x00d07c9b -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 139
12 libobjc.A.dylib 0x01cd5874 -[NSObject performSelector:withObject:withObject:] + 77
13 UIKit 0x00a330c2 -[UIApplication sendAction:to:from:forEvent:] + 108
14 UIKit 0x00a3304e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
15 UIKit 0x00b2b0c1 -[UIControl sendAction:to:forEvent:] + 66
16 UIKit 0x00b2b484 -[UIControl _sendActionsForEvents:withEvent:] + 577
17 UIKit 0x00b2a733 -[UIControl touchesEnded:withEvent:] + 641
18 UIKit 0x00a7051d -[UIWindow _sendTouchesForEvent:] + 852
19 UIKit 0x00a71184 -[UIWindow sendEvent:] + 1232
20 UIKit 0x00a44e86 -[UIApplication sendEvent:] + 242
21 UIKit 0x00a2f18f _UIApplicationHandleEventQueue + 11421
22 CoreFoundation 0x01ec983f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
23 CoreFoundation 0x01ec91cb __CFRunLoopDoSources0 + 235
24 CoreFoundation 0x01ee629e __CFRunLoopRun + 910
25 CoreFoundation 0x01ee5ac3 CFRunLoopRunSpecific + 467
26 CoreFoundation 0x01ee58db CFRunLoopRunInMode + 123
27 GraphicsServices 0x03e159e2 GSEventRunModal + 192
28 GraphicsServices 0x03e15809 GSEventRun + 104
29 UIKit 0x00a31d3b UIApplicationMain + 1225
30 Pizza to Go 0x000574ad main + 141
31 libdyld.dylib 0x0285e725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
What could be the possible fix? thanks for your time in advance.

I'm not sure but I think your destinationViewController isn't a RESTToppingTableViewController.
The log:
-[RESTAddToCartViewController toppingList]:
unrecognized selector sent to instance 0x9b681a0
states that you are trying to get the toppingList of a RESTAddToCartViewController but this controller has no toppingList property.
Make sure that the UIViewController returned by [segue destinationViewController] really is what you are expecting.

Related

Swift: Not able to navigate to another view controller

I really do not know what mistake am I doing in the following lines:
// Instantiate SecondViewController
let secondViewController = self.storyboard?.instantiateViewController(withIdentifier: "RegistrationScreen2View") as! RegistrationScreen2ViewController
self.navigationController?.pushViewController(secondViewController, animated: true)
I am not able to move to second view controller in the story board I have mentioned story board id as RegistrationScreen2View for RegistrationScreen2ViewController.
I am getting the following exception:
2016-10-24 11:26:16.607 toadways[965:11142] -[toadways.RegistrationScreen1ViewController continue]: unrecognized selector sent to instance 0x7fe05dc34ec0
2016-10-24 11:26:16.619 toadways[965:11142] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[toadways.RegistrationScreen1ViewController continue]: unrecognized selector sent to instance 0x7fe05dc34ec0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010efa534b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010ea0621e objc_exception_throw + 48
2 CoreFoundation 0x000000010f014f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010ef2ac15 ___forwarding___ + 1013
4 CoreFoundation 0x000000010ef2a798 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010f3cab88 -[UIApplication sendAction:to:from:forEvent:] + 83
6 UIKit 0x000000010f5502b2 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000000010f5505cb -[UIControl _sendActionsForEvents:withEvent:] + 444
8 UIKit 0x000000010f54f4c7 -[UIControl touchesEnded:withEvent:] + 668
9 UIKit 0x000000010f4380d5 -[UIWindow _sendTouchesForEvent:] + 2747
10 UIKit 0x000000010f4397c3 -[UIWindow sendEvent:] + 4011
11 UIKit 0x000000010f3e6a33 -[UIApplication sendEvent:] + 371
12 UIKit 0x000000010fbd8b6d __dispatchPreprocessedEventFromEventQueue + 3248
13 UIKit 0x000000010fbd1817 __handleEventQueue + 4879
14 CoreFoundation 0x000000010ef4a311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
15 CoreFoundation 0x000000010ef2f59c __CFRunLoopDoSources0 + 556
16 CoreFoundation 0x000000010ef2ea86 __CFRunLoopRun + 918
17 CoreFoundation 0x000000010ef2e494 CFRunLoopRunSpecific + 420
18 GraphicsServices 0x0000000116c0ca6f GSEventRunModal + 161
19 UIKit 0x000000010f3c8f34 UIApplicationMain + 159
20 toadways 0x000000010e2318bf main + 111
21 libdyld.dylib 0x000000011266368d start + 1
22 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Please let me know what mistake am I doing.
Your code should work. The most possibility is that you forgot to input an Storyboard ID for your destination ViewController.
***How to Fix:
In the Identity Inspector of destination ViewController, enter its ID.

NSInvalidArgumentException', reason: 'Receiver (<ViewController:>) has no segue with identifier '''

> 2014-09-20 18:04:45.564 storyboard_demo[6919:60b] nested push
animation can result in corrupted navigation bar 2014-09-20
18:04:45.921 storyboard_demo[6919:60b] Finishing up a navigation
transition in an unexpected state. Navigation Bar subview tree might
get corrupted. 2014-09-20 18:04:46.442 storyboard_demo[6919:60b] *
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'Receiver
() has no segue with identifier
'third''
* First throw call stack: ( 0 CoreFoundation 0x017ed1e4 exceptionPreprocess + 180 1 libobjc.A.dylib
0x0156c8e5 objc_exception_throw + 44 2 UIKit
0x0034d48c -[UIViewController
shouldPerformSegueWithIdentifier:sender:] + 0 3 storyboard_demo
0x0000254e -[secondViewController btn_second:] + 110 4
libobjc.A.dylib 0x0157e880 -[NSObject
performSelector:withObject:withObject:] + 77 5 UIKit
0x0022e3b9 -[UIApplication sendAction:to:from:forEvent:] + 108 6
UIKit 0x0022e345 -[UIApplication
sendAction:toTarget:fromSender:forEvent:] + 61 7 UIKit
0x0032fbd1 -[UIControl sendAction:to:forEvent:] + 66 8 UIKit
0x0032ffc6 -[UIControl _sendActionsForEvents:withEvent:] + 577 9
UIKit 0x0032f243 -[UIControl
touchesEnded:withEvent:] + 641 10 UIKit
0x0026dddd -[UIWindow _sendTouchesForEvent:] + 852 11 UIKit
0x0026e9d1 -[UIWindow sendEvent:] + 1117 12 UIKit
0x002405f2 -[UIApplication sendEvent:] + 242 13 UIKit
0x0022a353 _UIApplicationHandleEventQueue + 11455 14 CoreFoundation
0x0177677f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 15 15 CoreFoundation 0x0177610b __CFRunLoopDoSources0 + 235 16 CoreFoundation 0x017931ae __CFRunLoopRun + 910 17 CoreFoundation
0x017929d3 CFRunLoopRunSpecific + 467 18 CoreFoundation
0x017927eb CFRunLoopRunInMode + 123 19 GraphicsServices
0x037e15ee GSEventRunModal + 192 20 GraphicsServices
0x037e142b GSEventRun + 104 21 UIKit
0x0022cf9b UIApplicationMain + 1225 22 storyboard_demo
0x00002e4d main + 141 23 libdyld.dylib
0x01e3470d start + 1 24 ???
0x00000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught
exception of type NSException
(lldb)
Do it in two steps.
btn_second: can post a notification that it has been pressed and then return to 'first'. 'first' receives the notification and sets a flag. In viewWillAppear, 'first' checks the flag and does a 'third' segue if it's set.

Objective C++, SIGABRT signal

Im doing an iOS app(actually just copying code) from this tutorial http://hubpages.com/hub/Tutorial-on-Creating-an-IOS-5-SQLite-Database-Application-IOS-5-SQLite
and I can't run my app. Build succeds and then I get signal SIGABRT in my XCode.
2014-08-28 09:04:40.105 Whine2[526:60b] Problem with prepare statement
2014-08-28 09:04:40.109 Whine2[526:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
0 CoreFoundation 0x018d81e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x016578e5 objc_exception_throw + 44
2 CoreFoundation 0x018793f6 -[__NSArrayM objectAtIndex:] + 246
3 Whine2 0x000029bd -[kcbViewController viewDidLoad] + 269
4 UIKit 0x0043633d -[UIViewController loadViewIfRequired] + 696
5 UIKit 0x004365d9 -[UIViewController view] + 35
6 UIKit 0x00356267 -[UIWindow addRootViewControllerViewIfPossible] + 66
7 UIKit 0x003565ef -[UIWindow _setHidden:forced:] + 312
8 UIKit 0x0035686b -[UIWindow _orderFrontWithoutMakingKey] + 49
9 UIKit 0x003613c8 -[UIWindow makeKeyAndVisible] + 65
10 UIKit 0x00311bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
11 UIKit 0x00316667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
12 UIKit 0x0032af92 -[UIApplication handleEvent:withNewEvent:] + 3517
13 UIKit 0x0032b555 -[UIApplication sendEvent:] + 85
14 UIKit 0x00318250 _UIApplicationHandleEvent + 683
15 GraphicsServices 0x038cdf02 _PurpleEventCallback + 776
16 GraphicsServices 0x038cda0d PurpleEventCallback + 46
17 CoreFoundation 0x01853ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
18 CoreFoundation 0x018539db __CFRunLoopDoSource1 + 523
19 CoreFoundation 0x0187e68c __CFRunLoopRun + 2156
20 CoreFoundation 0x0187d9d3 CFRunLoopRunSpecific + 467
21 CoreFoundation 0x0187d7eb CFRunLoopRunInMode + 123
22 UIKit 0x00315d9c -[UIApplication _run] + 840
23 UIKit 0x00317f9b UIApplicationMain + 1225
24 Whine2 0x0000282d main + 141
25 libdyld.dylib 0x01e21701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I understand there is some problem with array, right?
As your error message and code in the link says, there is one array named wines in viewDidLoad of kcbViewController and it is empty. aJust log the array wines before accessing it . If you need to check whether an array is empty, you can check if self.wines.count is 0.

Unrecognized selector sent to instance, Storyboard bug after connecting a button to view controller

I was messing with my storyboard with no code involved and got this error after I connected "Terms of use" button to a view controller. It was working fine before this action.
-I created and connected a class to Terms of Use View Controller
-I used action push segue to connect
2014-01-22 17:26:45.434 Project[1162:a0b] -[AboutViewController termsOfUseButton:]: unrecognized selector sent to instance 0x8c89d40
2014-01-22 17:26:45.437 Project[1162:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AboutViewController termsOfUseButton:]: unrecognized selector sent to instance 0x8c89d40'
*** First throw call stack:
(
0 CoreFoundation 0x0173b5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014be8b6 objc_exception_throw + 44
2 CoreFoundation 0x017d8903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0172b90b ___forwarding___ + 1019
4 CoreFoundation 0x0172b4ee _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x014d0874 -[NSObject performSelector:withObject:withObject:] + 77
6 UIKit 0x0022e0c2 -[UIApplication sendAction:to:from:forEvent:] + 108
7 UIKit 0x0022e04e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
8 UIKit 0x003260c1 -[UIControl sendAction:to:forEvent:] + 66
9 UIKit 0x00326484 -[UIControl _sendActionsForEvents:withEvent:] + 577
10 UIKit 0x00325733 -[UIControl touchesEnded:withEvent:] + 641
11 UIKit 0x0026b51d -[UIWindow _sendTouchesForEvent:] + 852
12 UIKit 0x0026c184 -[UIWindow sendEvent:] + 1232
13 UIKit 0x0023fe86 -[UIApplication sendEvent:] + 242
14 UIKit 0x0022a18f _UIApplicationHandleEventQueue + 11421
15 CoreFoundation 0x016c483f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x016c41cb __CFRunLoopDoSources0 + 235
17 CoreFoundation 0x016e129e __CFRunLoopRun + 910
18 CoreFoundation 0x016e0ac3 CFRunLoopRunSpecific + 467
19 CoreFoundation 0x016e08db CFRunLoopRunInMode + 123
20 GraphicsServices 0x036909e2 GSEventRunModal + 192
21 GraphicsServices 0x03690809 GSEventRun + 104
22 UIKit 0x0022cd3b UIApplicationMain + 1225
23 Project 0x00003a9d main + 141
24 libdyld.dylib 0x01d77725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
(Lame but I found the solution after I finished writing the question)
The reason for this error is I created an IBAction-UIButton method on touch up inside.
I deleted that code and hoped the traces were deleted.
It seems it wasnt, I had to unconnect the touch up inside by clicking the X in red squared spot.
I would try recreating the button and the segue, maybe you changed the IBOutlet name by accident or any other thing.
GL HF

What is causing my EXC_BAD_ACCESS? (iPhone SDK)

- (IBAction)startSignin:(id)sender {
Login *aview = [[Login alloc] init];
aview.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.navigationController presentModalViewController:aview animated:YES];
[_window addSubview:aview.view];
[aview release];
}
What is causing my EXC BAD ACCESS?
Every time it loads Login, It crashes whenever i press a button or something on that page.
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f16313 objc_exception_throw + 44
2 CoreFoundation 0x00d7aef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00d7ae6a +[NSException raise:format:] + 58
4 UIKit 0x000c6709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x000c4134 -[UIViewController loadView] + 120
6 UIKit 0x000c400e -[UIViewController view] + 56
7 UIKit 0x00037d42 -[UIWindow addRootViewControllerViewIfPossible] + 51
8 Test 0x00001b3c -[TestAppDelegate application:didFinishLaunchingWithOptions:] + 220
9 UIKit 0x00014c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
10 UIKit 0x00016d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
11 UIKit 0x00021617 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit 0x00019abf -[UIApplication sendEvent:] + 71
13 UIKit 0x0001ef2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x00ffb992 PurpleEventCallback + 1550
15 CoreFoundation 0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00d03cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00d00f83 __CFRunLoopRun + 979
18 CoreFoundation 0x00d00840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00d00761 CFRunLoopRunInMode + 97
20 UIKit 0x000167d2 -[UIApplication _run] + 623
21 UIKit 0x00022c93 UIApplicationMain + 1160
22 Test 0x00001a29 main + 121
23 Test 0x000019a5 start + 53
)
terminate called throwing an exceptionCurrent language: auto; currently objective-c
This is frequently caused by accessing an object after it is released. This is a good point to familiarize yourself with the debugger, too. Set a break point on the first line of the button action method, and step through it to find out which line is bad.
This time, i suspect it is your call to addSubview:, the presentModal… will take care of presenting the view.

Resources