I have an app with no nibs. Its rootviewcontroller is a tableviewcontroller. I am having it push to a second tableviewcontroller, which controls a detailview. Just earlier this week, I had it successfully pushing to the next tableviewcontroller. A few days later (and after maybe saving the wrong version),
I get an
(lldb) with a breakpoint at the pushViewController method when I select a table item. I have breakpoints for all exceptions enabled. If I press the play button twice more, I get this in my output box:
" ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "TopicsDetailViewController" nib but didn't get a UITableView.'"
Is there something wrong here or do I need to look elsewhere in my project?
This is in my header interface:
TopicsDetailViewController *tdvController;
: ) And this is my didSelectRowAt...
tdvController = [[TopicsDetailViewController alloc] init];
tdvController.aFeed = afeed;
[self.navigationController pushViewController:tdvController animated:YES];
tdvController = nil;
Thank you, and let me know if I'm barking up the wrong tree.
If I'm understanding this correctly, your tdvController declaration in the interface file is named the same as the tdvController in the instance method where you are getting the exception.
If your intentions are to create and use the instance variable in this instance method don't declare it again, just do:
self.tdvcController = [[TopicsDetailViewController alloc] init];
Which is creating the object on the heap.
If you intentions are to use a local variable of type TopicsDetailViewController in this instance method that is not the iVar, then rename the local variable to something else.
Related
After I completed the tutorial: Start Developing iOS Apps Today
I got the same exception asked here: IOS Tutorial Exception (ToDo Sample)
and the app crashed but it would not crash if I started a debugging session and stepped through the code.
2015-05-04 16:09:51.569 ToDoList[9223:67681] -[AddToDoItemViewController textField:]: unrecognized selector sent to instance 0x7fe570d4eff0
2015-05-04 16:09:51.574 ToDoList[9223:67681] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AddToDoItemViewController textField:]: unrecognized selector sent to instance 0x7fe570d4eff0'
Then I solved the mystery by reading out this post: IOS Tutorial Exception (ToDo Sample)
The reason was that I wrongly connected the text field to the #implemenation section instead of to the #interface section and it created some method that I deleted. Of course I forgot about that soon after that.
How could I have figured out myself without knowing anything of the above what was the reason to get that exception and where it came from?
Log message is telling you that something was trying to call -textField: method of your AddToDoItemViewController.
So the first step would be to check if that method is implemented - in your case it was not. You might have been confused by the presence of
#property(weak, nonatomic) IBOutlet UITextField* textField
but auto synthesis for property generates getter with the signature -textField, which is different from -textField: (latter takes one parameter, while former none).
The exception says that you're trying to access the textView property of AddToDoItemViewController, but it doesn't have one.
So your next step would've been to go and check that you have a property like that declared and being an outlet that it's properly connected in the Interface Builder.
Edit:
Sorry I wasn't paying enough attention.
The selector that it's trying to call is textField: so it must be a function starting like that. I assume you set the controller as a TextView delegate but didn't implement the required method.
What I'm trying to perform
A programmatic unwind from Screen C back to Screen A (normally A->B->C)
What I've done
I've created the function - (IBAction)unwindToScreenA:(UIStoryboardSegue *)unwindSegue {
in Screen A's .m and its definition in .h file.
I've created an manual unwind in Screen C by CTRL-Dragging from Owner Icon to Escape Icon (unwind segue exists, but not tied to any button)
I've given the unwind a name, and then in the code I perform [self performSegueWithIdentifier:#"unwindFromCtoA" sender:self];
In other words, I think I've strictly done what's needed for this task. I did have it working before, but something else I changed must have broken it, and I can't trace the error.
The error I have
2014-02-06 13:28:28.899 PrototypeApp2[2885:60b] -[DMSScreenCViewController tag]: unrecognized selector sent to instance 0x14e7ff60
2014-02-06 13:28:28.902 PrototypeApp2[2885:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[DMSScreenCViewController tag]: unrecognized selector sent to instance 0x14e7ff60'
*** First throw call stack:
(0x2ddf7f4b 0x382386af 0x2ddfb8e7 0x2ddfa1cb 0x2dd494d8 0xc966d 0x30ae6d63 0xca34f 0x30782dcd 0x30782c15 0x306878bb
0x3073af7b 0x305eafb9 0x305631f3 0x2ddc31cd 0x2ddc0b71 0x2ddc0eb3 0x2dd2bc27 0x2dd2ba0b 0x32a52283 0x305cf049 0xc80a5 0x38740ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
UPDATE
Changing
[self performSegueWithIdentifier:#"unwindFromCtoA" sender:self];
to
[self performSegueWithIdentifier:#"unwindFromCtoA" sender:Nil];
fixed it. Any ideas why?
The issue happened when you try to call tag property on your DMSScreenCViewController object.
This is a UIViewController subclass and there is no tag property so you cannot call it.
Maybe you try to call tag on your destination or source view controller in your segue method which is reference to DMSScreenCViewController object.
DMSScreenCViewController Check that this is the expected class as I suspect it's not.
You may have to update a storyboard
I'm trying to develop an app that can show a PDF file. I try to complete this with ZoomingPDFViewer
http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010281-Intro-DontLinkElementID_2
code that is in the apple library. When I mix that code with my code some function doesn't work. And if I make it with the same code (don't mixed) the app throw this error:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setPDFPage:]: unrecognized selector sent to instance 0x6a833f0'
I'm in SDK 5.0 the requirements says that I should compile it in SDK 5.1 but the sample runs perfect, the problem is in my project but I don't know what is my error.
I'll appreciate if someone can help me with this strange error.
Check the Class setting in Storyboard.
View Controller -> Custom Class: ZoomingPDFViewerViewController and
Scroll VIew -> Custom Class: PDFScrollView
The second setting is the cause of your error.
You seem to be sending -setPDFPage: to an uncast self.view object. Try casting before calling like so:
[(PDFScrollView *)self.view setPDFPage:PDFPage];
Double check your connections in IB, if you are using it, or make sure you are initing a PDFScrollView* object in -loadView if not.
I'm new on developping on iPhone and I encounter pretty much problem with my project.
The project, based on empty app : a tabbar app(item1,item2). item1 is a simple viewcontroller(ProfilViewController) and is part of navigationcontroller. a button from item1 push a tableviewcontroller (MainMantraViewController).
Aside, I have my CoreData with a single entity : Mantra,made of 3 attributes:phrase,theme,partage. I try to fill it at the launch to test the bundle between coredata and the tableviewcontroller.
here is my appdelegate.m, under didfinishlaunching:
ProfilViewController *rootView =(ProfilViewController *)self.window.rootViewController;
rootView.managedObjectContext=self.managedObjectContext;
//donnée test
Mantra * newMantra=(Mantra *)[NSEntityDescription insertNewObjectForEntityForName:#"Mantra" inManagedObjectContext:self.managedObjectContext];
newMantra.phrase =#"ca pu du cul";
newMantra.theme = #"rire";
Runnning the app, I get the following *
(edited)
*:
**2012-05-24 16:26:09.690 Proto v0[1843:fb03] -[UITabBarController setManagedObjectContext:]: unrecognized selector sent to instance 0x6a4a690
2012-05-24 16:26:09.693 Proto v0[1843:fb03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarController setManagedObjectContext:]: unrecognized selector sent to instance 0x6a4a690'**
I'm completly stucked at this point and i can't find any conclusive clue anywhere.
I thank you for your help and will provide any helpfull snipets.
Cheers
Well, the error log is clear enough, you are calling 'topViewController' somewhere on the UITabBarController, but UITabBarController doesn't have a property called 'topViewController'. I think you want to use 'selectedViewController'.
I know there is a lot of resources about that here but yet, I can't find what's going wrong with my code:
I have a class Level and two subclasses of Level: GameLevel and TransitionLevel. Each of this class implements the NSCoding protocol.
Then, I've got an array of Level (so it contains both classes of GameLevel and TransitionLevel). Saving the archive seems to work fine :
NSString *archivePath = [DOCUMENT_DIRECTORY stringByAppendingPathComponent:#"levels.archive"];
[NSKeyedArchiver archiveRootObject:levels toFile:archivePath];
Note that levels is the array I want to save. I can see the file, it's created and seems to contains what it's supposed to contain.
But when I want to retrieve this array :
NSString *archivePath = [DOCUMENT_DIRECTORY stringByAppendingPathComponent:#"levels.archive"];
levels = [NSKeyedUnarchiver unarchiveObjectWithFile:archivePath];
I've got this exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
I'm not sure what I'm missing here.
Either your implementation of initWithCoder: returns nil, either some part of your code tries to insert a nil value into an array.
You may go in the Breakpoint Navigator (⌘6) and add an Exception Breakpoint. Then, when the application raises an exception, the Debug Navigator will display the stack of the functions and methods currently executed. This would allow you to know precisely which method is trying to insert nil into an array.