If i add an object to a property “dreamsArr”, which is NSMutableArray:
@synthesize dreamsArr;
-(void) viewDidLoad
{
Dream *d1 = [[Dream alloc] init];
d1.title = [[NSString alloc] initWithString:@"my 1st dream"];
self.dreamsArr = [[NSMutableArray alloc] init];
[self.dreamsArr addObject:d1];
Dream *dr = [self.dreamsArr objectAtIndex:0];
NSString *title=dr.title;
const char *chTitle = [title UTF8String];
NSLog(@"%s", chTitle);
}
Why does NSLog print “null”?
when i trace this code, after [self.dreamsArr addObject:d1] , dreamsArr still empty, why?
problem was in the other part of code