properties - NSImage property always return null? -


i have custom class called movie. simple 3 properties:

.h

@interface wtamovie : nsobject  @property (strong, nonatomic) nsimage *theimage; @property (strong, nonatomic) nsstring *thetittle; @property (strong, nonatomic) nsstring *theblurb;   @end 

the .m has initializer sets default values properties , description method returning values of properties if custom object logged. this.

-(nsstring *)description { nsstring *desc = [nsstring stringwithformat:@"<movie> - theimage = %@, thetittle = %@,     theblurb = %@", _theimage, _thetittle, _theblurb]; return desc; }  -(id)init {  self = [super init]; if (self) {      _thetittle = @"new tittle";     _theblurb = @"empty blurb";       nsstring* imagename = [[nsbundle mainbundle] pathforresource:@"reel" oftype:@"png"];     _theimage = [[nsimage alloc] initwithcontentsoffile:imagename];       nslog(@"from person calss init: %@", _theimage);  }  return self; } 

in document.m file initializer creating new movie object, putting in array defined hold movie objects , logging object. this:

- (id)init { self = [super init]; if (self) {     // add subclass-specific initialization here.     _movies = [nsmutablearray new];     wtamovie *firstmovie = [wtamovie new];     [_movies addobject:firstmovie];     (id object in _movies)     {          nslog(@"%@", object);      }  } return self; } 

the output in console is:

2013-07-15 13:47:57.174 homeworkfour[5044:303] - theimage = (null), thetittle = new tittle, theblurb = empty blurb

the image saying null? not it. can see setting file added project????

ok, ended being dumb. image resource .jpeg , in my: [[nsbundle mainbundle] pathforresource:@"reel" oftype:@"png"];

i had given oftype of png.

one comment though, not case nsimage show null in descriptor when logged console. once nsimage initialized correctly when logged out object show several pieces of information object memory location , on screen drawing parameters.


Comments