I'm moving my initial steps in the Core Data realm (and I'm quite new to iPhone development, too) and I found a behavior I cannot explain. I declared a subclass of a NSManagedObject and defined a few properties, some of them of type NSString *, MyObject.h is something like:
@interface MyObject : NSManagedObject {
}
@property (nonatomic, retain) NSString *contentFile;
@property (nonatomic, retain) NSString *contentPath;
@property (nonatomic, retain) NSDate *creationDate;
@property (nonatomic, retain) NSString *name;
@end
Now, if I try to create an object instance and assign a value to the name property, when I try to print back the content of the property it seems it's mangled. In the AppDelegate, where the whole Core Data stack is defined, I write:
MyObject *newObject = [NSEntityDescription insertNewObjectForEntityForName:@"MyObject"
inManagedObjectContext:self.managedObjectContext];
newObject.name = @"Testing";
NSLog([NSString stringWithFormat:@"Name: %s\n", newObject.name]);
What I get in the output console is
2009-08-24 20:03:55.176 MyApp[15727:20b] Name: ‡}00»
I can't understand if I'm doing something wrong or if I forgot something. Anyone can help, please?