Theocacao
Leopard
Design Element
Comment on "A Quick Objective-C 2.0 Tutorial: Part II"
by Scott Stevenson — Nov 04
@Drew McCormack: I wish it did. I just tested this too, and get the same error at runtime, ie, that setTitle: doesn't exist.

I just made a Core Data project from scratch with this for the header:
@interface Movie : NSManagedObject { } @property (retain) NSString * title; @end

And this for the implementation:
@implementation Movie @dynamic title; @end

This in the controller:
- (IBAction)testTitle:(id)sender { Movie* movie; movie = [NSEntityDescription insertNewObjectForEntityForName:@"Movie" inManagedObjectContext:self.managedObjectContext]; movie.title = @"My Movie"; [movie setTitle:@"My Movie 2"]; NSLog(@"%@", movie.title); }

It prints "My Movie 2" and no exceptions are raised. Are you sure your model is correct?
Back to "A Quick Objective-C 2.0 Tutorial: Part II"
Design Element

Copyright © Scott Stevenson 2004-2015