I have two view controllers that both return to the home VC using
[self dismissModalViewControllerAnimated:NO];
One of them works and triggers it using a storyboard created button, whilst the one that doesn't work triggers it using a programmatically created button.
When the button on the second one is pressed it does move to the home VC, but instantly crashes
Update:
New Output
** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_questioner_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTYxYWQ0YjBlMTY1MGIwZjZlMDA5NDkxNmI2MzQxZmFhBjsAVA%3D%3D--15054ec7f94935cfc07bad559f1d52cd65ea5e4b: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled.
Key path: scoringData
Observed object:
It seems to crash when it gets to this point
+(void)processScoringData:(NSMutableData*)response
{
[DataStore dataStore].scoringData = [[NSMutableDictionary alloc]init];
After adding an exception break point I get this beside the output. Not sure if it helps?
ServerInterface
(Class) [0] = <error: unknown Class>
response = (NS MutableData*)
NSData NSData
NSObject NSObject
isa Class 0x3c35b9ac
[0] Class <error: unknown Class>
[self dismissViewControllerAnimated:NO completion:nil]; use instead of your dismiss controller method because your method is deprecated.
Definitely work for You.
Related
I've a really strange error, and I cannot find the problem.
In my iPad APP I've a UINavigationController, a UITableViewController as master and a UIViewController containing a UIWebView as detail.
I launch the APP, the UITableViewController is shown. By segue I open the detail as usual. Then I have a back button in my detailviewcontroller that calls this method
[self.contentWebView setDelegate:nil];
[self.contentWebView stopLoading];
[self.navigationController popViewControllerAnimated:YES];
It gets poped and the master is shown again. Its
- (void)viewWillAppear:(BOOL)animated
gets called, but then I get the following error:
2014-06-06 15:56:58.156 Knowledge[356:60b] -[_UIWebViewScrollViewDelegateForwarder scrollViewWasRemoved:]: unrecognized selector sent to instance 0x170429f60
2014-06-06 15:56:58.159 Knowledge[356:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIWebViewScrollViewDelegateForwarder scrollViewWasRemoved:]: unrecognized selector sent to instance 0x170429f60'
*** First throw call stack:
(0x189582f50 [...] 0x196553aa0)
libc++abi.dylib: terminating with uncaught exception of type NSException
BUT, this happens only on the iPad Air... older iPads work as expected
UPDATE:
I added now the command [self.contentWebView removeFromSuperview]; after "stopLoading" and now the error is happing right up there.
Please ignore this answer if you are not touching scroll view's (of the web view) delegate reference.
I was facing the same strange error. After some investigation, I found that it was happening because scroll view's (of the web view) delegate was altered in controller's viewDidLoad method:
[self webView].scrollView.delegate = self;
In some cases, scroll view invokes delegate method(s) even after your view controller is destroyed. This should be prevented by weak delegate reference, but for some reason scroll view calls delegate method on deallocated (zombie) object anyway. I assume this is a bug in the framework.
So here what you can do: set delegate reference to nil in your controller's dealloc method:
- (void)dealloc
{
[self webView].scrollView.delegate = nil;
}
After deallocation, scroll view will be prevented from calling any method on no longer existing controller.
I am trying to get a pop up menu on iPhone.
The main app is using storyboard, but the pop up is a separate xib file that I load:
menu = [[UIViewController alloc] initWithNibName:#"SimpleMenuController" bundle:nil];
[self.view addSubview:menu.view];
and I slide it in and out with animation when pressing a button.
that works fine, but I get a problem when I try to press a button inside that pop up menu
I get the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[UIViewController PressCategory:]:
unrecognized selector sent to instance 0x8d3c040'
I have connected the button to PressCategory function
I have connected the view to the file owner.
What I have noticed is that my ViewController is called SimpleMenuViewController, that is where the PressCategory function is, so of course it will not find the selector. But I don't know what I am doing wrong in connecting in the xib file.
Change your code to:
menu = [[SimpleMenuViewController alloc] initWithNibName:#"SimpleMenuController" bundle:nil];
so that you're instantiating the correct class.
Do you have PressCategory function in your SimpleMenuViewController?
If yes, then check weather its parameterized or not.
Declare function in .h file like this:
-(IBAction)PressCategory:(UIButton *)sender;
Define it in .m file like this:
-(IBAction)PressCategory:(UIButton *)sender {
// write your code here
}
There are so many cases for "Unrecognized Selector Sent To Instance", I don't think I will find mine in so many threads. Or if I do it will take a month or so.
To be short. I receive this error, and my situation is:
I have a table view displaying recipes that are fetched from Core Data. When segue fires, it gets destination controller (which is UITabBarController), and provides a recipe for it.
The code for the segue method is:
if ([segue.identifier isEqualToString:#"RecipeTabBarController"]) {
RecipeTabBarController *VC = segue.destinationViewController;
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
Recipe *recipe = (Recipe*)[_controller objectAtIndexPath:indexPath];
VC.recipe = recipe;
}
TabBarController (which is the VC) has a property of a recipe, like so:
#property (nonatomic, strong) Recipe *recipe;
When I tap the cell, the segue fires, and the error occurs, with the following message from console:
2013-09-25 18:55:21.888 RecipeBank [974:60b] -[UITabBarController setRecipe:]: unrecognized selector sent to instance 0x15da8280
2013-09-25 18:55:21.892 RecipeBank [974:60b] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarController setRecipe:]: unrecognized selector sent to instance 0x15da8280'
First throw call stack:
(0x30583f53 0x3abec6af 0x305878e7 0x305861d3 0x304d5598 0x6676f 0x3319f6f1 0x665b7 0x32e1232b 0x32ec5253 0x32d75971 0x32ced473 0x3054f1d5 0x3054cb79 0x3054cebb 0x304b7ce7 0x304b7acb 0x35185283 0x32d59a41 0x67711 0x3b0f4ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
RecipeTabBarController imports Recipe class in header and TableViewController that's performing segue imports RecipeTabBarController for it as well. So no mistake there.
What could be wrong?
Please help. Thanks.
Sounds like the class of the destination view controller is UITabBarController and not your own class RecipeTabBarController. Look in your storyboard as to how you have the segue set up and figure out why things are not what you expect.
I'm trying to create this application, when you press on a tablecell you get shown the ViewController, and the variable get's set in the other view controller. Although i'm getting a few errors when i press the uitablecell.
Error:
2013-04-06 22:47:25.970 iFSX Guide[1069:907] Called
2013-04-06 22:47:26.009 iFSX Guide[1069:907] -[__NSCFString _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x1d562390
2013-04-06 22:47:26.016 iFSX Guide[1069:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x1d562390'
*** First throw call stack:
(0x319b22a3 0x3964c97f 0x319b5e07 0x319b4531 0x3190bf68 0x33832beb 0x338a837f 0x338548fb 0x33a95619 0x338a79b9 0x338a5fe7 0x339c83ef 0xa22a5 0x3387c28d 0x338fef81 0x322c0277 0x319875df 0x31987291 0x31985f01 0x318f8ebd 0x318f8d49 0x354ba2eb 0x3380e301 0xa19d1 0x39a83b20)
libc++abi.dylib: terminate called throwing an exception
The code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)in dexPath{
NSLog(#"Called");
Aircraft = indexPath.row;
[self performSegueWithIdentifier:#"ToSections" sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:#"ToSections"]){
AirplaneSections *sections = (AirplaneSections *)segue.destinationViewController;
sections.plane = Aircraft;
}
}
I've found out that it's an error on ViewDidLoad on the viewcontroller.
NSString *quickTemp = [NSString alloc];
switch (plane) {
case 0:
quickTemp = #"Boeing 737-800";
break;
default:
break;
}
TitleLabel.text = quickTemp;
*/
I'm doing something wrong there.
Are you using ARC? This sort of problem usually indicates there's a memory error somewhere. Basically, some code somewhere is trying to access an object that was already released. This makes everything go kaboom.
If you aren't using ARC, you should turn it on.
After that, the next thing you should do is run the static analyzer. Fix anything that comes up.
If that doesn't fix the problem, in Xcode, add a breakpoint that stops when an Objective-C exception is thrown. It should show you where exactly this problem is happening.
If that doesn't help, run your code under Instruments' and the Zombie tool. This will show you exactly where you tried to access memory that was already released.
I'm using Action Sheet Picket. I added .h and .m files as instructed in readme, picker and even cancelAction is working well but somehow successAction throws NSInvalidArgumentException with this message: "unrecognized selector sent to instance".
Application is a kind of tab bar application with Navigation Controller. There is a TabBarController as root and there are ViewControllers which are located under the TabBarController and one of the ViewControllers is a Navigation Controller. But I'm not getting this error in Navigation Controller. I'm not sure if this causes any error.
Here how I used:
- (IBAction)filterResult:(id)sender {
[ActionSheetStringPicker showPickerWithTitle:#"Pick Filter" rows:self.filterList initialSelection: self.selectedIndexes target:self successAction:#selector(animalWasSelected:element:) cancelAction:nil origin: self];
}
- (void)animalWasSelected:(NSNumber *)selectedIndex element:(id)element {
self.selectedIndexes = [selectedIndex intValue];
NSLog(#"Selected");
}
Yes that's all. I've already included ActionSheetPicker.h file and as I said picker is working fine.
Finally here is error:
[MYYViewController successAction:]: unrecognized selector sent to instance 0x9032400
2012-12-24 12:14:45.488 Example[54268:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MYYViewController successAction:]: unrecognized selector sent to instance 0x9032400'
Any help would be great.
Looks rather straight forward, you need to implement successAction: in your MYYViewController class, because the picker is not checking if it will respond or not and calling it directly.