Note that there are some explanatory texts on larger screens.

plurals
  1. POXCode 4.2 NSManagedObject context build failed
    primarykey
    data
    text
    <p>I created an UserModel.xcdatamodeld with one Entry: UserBase, and I added an attribute which name is UserID and type is Integer 32.</p> <p>After that, I create classes for it with file->new file->NSManagedOBject subclass, which creates UserBase.h and .m automatically.</p> <p>In my controller imported the UserBase.h file, and create a property:</p> <pre><code>NSManagedObjectContext *userBaseObjectContext; </code></pre> <p>with</p> <pre><code>@property (nonatomic, retain) NSManagedObjectContext *userBaseObjectContext; </code></pre> <p>In mycontroller.m file synthetized the userBaseObjectContext property and in DidLoad function I tried this:</p> <pre><code>UserBase *userObject=(UserBase *)[NSEntityDescription insertNewObjectForEntityForName:@"UserBase" inManagedObjectContext:userBaseObjectContext]; [userObject setUserID:[NSNumber numberWithInt:42]]; NSError *error; if(![userBaseObjectContext save:&amp;error]) { UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Application error" message:@"error" delegate:nil cancelButtonTitle:@"Close" otherButtonTitles:nil,nil]; [alert show]; [alert release]; } else NSLog(@"not working..."); </code></pre> <p>When I try to build my project, I got this error:</p> <pre><code>Undefined symbols for architecture i386: "_OBJC_CLASS_$_NSEntityDescription", referenced from: objc-class-ref in LoginController.o "_OBJC_METACLASS_$_NSManagedObject", referenced from: _OBJC_METACLASS_$_UserBase in UserBase.o "_OBJC_CLASS_$_NSManagedObject", referenced from: _OBJC_CLASS_$_UserBase in UserBase.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre> <p>What is that means?</p> <p>I followed this tutorial: <a href="http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/" rel="noreferrer">http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload