Welcome, Guest
Username Password: Remember me

Warning messages in ViewDidLoad. Cannot find method..
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Warning messages in ViewDidLoad. Cannot find method..

Warning messages in ViewDidLoad. Cannot find method.. 1 year, 3 months ago #1

Hi Tarek, I am trying to build in a an STV Controller into an existing project. I am getting two warning messages as follows:

: 'SCClassDefinition' may not respond to '+definitionWithEntityName:withManagedObjectContext:withPropertyNames:'

and"

warning: no '-initWithTableView:withViewController:withEntityClassDefinition:' method found.

A section of code is below where the errors occur. If you would please give me some pointers of where to look...

Also, maybe this is serious enough to start from scratch?

Thanks

David






- (void)viewDidLoad {
[super viewDidLoad];
 
// Set up the edit and add buttons.
self.navigationItem.leftBarButtonItem =
self.editButtonItem;
 
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
 
// Get managedObjectContext from application delegate
NSManagedObjectContext *managedObjectContext = [(AppDelegate *)[UIApplication sharedApplication].delegate managedObjectContext];
 
// Create a class definition for CardEntity
SCClassDefinition *cardDef =
[SCClassDefinition definitionWithEntityName:@"CardEntity" withManagedObjectContext:managedObjectContext
withPropertyNames:[NSArray arrayWithObjects:@"frontWord", @"backWord", @"notes", @"tableStuff", nil]];
 
 
//property definition customization
 
SCPropertyDefinition *cardPropertyDef = [cardDef propertyDefinitionWithName:@"frontWord"];
cardPropertyDef.attributes = [SCArrayOfObjectsAttributes attributesWithObjectClassDefinition:cardDef
allowAddingItems:YES
allowDeletingItems:YES
allowMovingItems:NO];
((SCArrayOfObjectsAttributes *)cardPropertyDef.attributes).allowEditingItems = NO;
 
 
// Instantiate the tabel model
tableModel = [[SCArrayOfObjectsModel alloc] initWithTableView:self.tableView withViewController:self
withEntityClassDefinition:cardDef];
tableModel.searchBar = self.searchBar;
tableModel.searchPropertyName = @"frontWord";
tableModel.addButtonItem = self.navigationItem.rightBarButtonItem;
tableModel.autoSortSections = TRUE;
tableModel.sectionIndexTitles = [NSArray arrayWithObjects:@"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z", nil];
 
// no need to add any sections as SCArrayOfObjectsModel automatically generates its sections
// from the SCTableViewModelDataSource method implemented below
}
 

Re: Warning messages in ViewDidLoad. Cannot find method.. 1 year, 3 months ago #2

Hi David,

Are you sure your project imports Core Data in the prefix header file (found under Other Sources->myProjectName_Prefix.pch)? Apple's templates usually import Core Data in this file, but if it's not there, please add the following line to the imports:

#import <CoreData/CoreData.h>


Hope this helps!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Warning messages in ViewDidLoad. Cannot find method.. 1 year, 3 months ago #3

That was it. Thanks Tarek. I was importing CoreData.h into some specific header files, not the prefix file.

Now on to the next bug....
  • Page:
  • 1
Time to create page: 0.90 seconds