Showing posts with label header. Show all posts
Showing posts with label header. Show all posts

Wednesday, March 23, 2011

Request for member 'item' in something not a structure or union

There are several ways how you can get this compiler error - and here's another one. With one way to fix it.

First setup everything:
@interface MyPlayer : MPMoviePlayerViewController
{
UIView *parentView;
}
@property (nonatomic, retain) UIView *parentView;
@end

@interface MyView : UIView
{
MyPlayer *myPlayer;
}
@end
This doesn't work, compiler error:
self.myPlayer = [[MyPlayer alloc] init];
self.myPlayer.parentView = self;
This is ok:
MyPlayer *player = [[MyPlayer alloc] init];
player.parentView = self;
self.myPlayer = player;
[player release];
Divide and conquer... If this didn't help you, remember to check that you import correct header files.

Friday, March 19, 2010

Accessing Unknown 'backgroundColor' Component of a Property

Embarrassing problem. Forgot to import the header file or add class forward declaration. Somehow you'd expect those to happen automatically, don't you think?

Code works as-is right after import has been done. Just adding this reminder for google to find next time.