louisD
louisD

Reputation: 175

bundling Core Data to tableviewcontroller (himself in a navigation controller(himself in a tabbarcontroller))

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 *

*:

**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

Upvotes: 0

Views: 324

Answers (1)

Rick van der Linde
Rick van der Linde

Reputation: 2591

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'.

Upvotes: 1

Related Questions