物业'查看; 没有在“x”types的对象上find
我目前正在为Xcode SDK iOS 5上的iPhone开发一个Radio应用程序,而且我正在使用苹果提供的StichedStreamPlayer中的一些元素。 我遇到的问题是ApplicationDidFinishLaunching
部分
这是我的代码:
appDelegate.m #import "iGamerFMAppDelegate.h" @class iGamerFMStreamingViewController; @implementation iGamerFMAppDelegate @synthesize window; @synthesize iGamerFMViewController; - (void)applicationDidFinishLaunching:(UIApplication *)application { //Adds the streaming view controller once finished loading [window addSubview:iGamerFMViewController.view]; [window makeKeyAndVisible]; } -(void)dealloc { [window release]; [iGamerFMViewController release]; [super dealloc]; } @end
我得到一个错误 – 属性“视图”未find对象的types“iGamerFMViewController”我已经尝试了一切从重写它复制和粘贴从另一个项目,它仍然不工作。 你知道这是为什么吗?
确保你的视图控制器select了正确的类。
我们可以看到iGamerFMViewController
的代码吗?
我假设iGamerFMViewController
应该iGamerFMViewController
UIViewController
所以它应该看起来像这样
@interface iGamerFMViewController : UIViewController
或者如果它没有iGamerFMViewController
有一个名为view
的属性
附注 – “类”通常以大写字母开头,它使得它更清楚,它是一个类,而不是一个variables或方法。
另外,你通常会在.m文件中执行#import "iGamerFMStreamingViewController.h"
,否则编译器必须读取整个类,而不是只读它。