2011-07-30 32 views
2

我目前正在爲Xcode SDK iOS 5上的iPhone開發一個Radio應用程序,並且我正在使用蘋果提供的StichedStreamPlayer中的一些元素。我有問題,問題是ApplicationDidFinishLaunching部分Property'View;找不到類型爲「x」的對象

這裏是我的代碼:

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 

我得到一個錯誤 - 物業「查看」上鍵入「iGamerFMViewController」的對象沒有找到 我已經嘗試了一切從重寫它從另一個項目複製和粘貼,它仍然不起作用。你知道爲什麼會發生這種情況嗎?

+1

爲什麼在.m文件中有@class聲明?您需要導入.h文件。你如何初始化iGamerFMStreamingViewController? – hwaxxer

+0

你可以發佈.h嗎? – Saphrosit

+0

iGamerFMViewController是類還是對象? – sidyll

回答

0

我們能看到iGamerFMViewController的代碼嗎?

我假設iGamerFMViewController應該繼承UIViewController所以它應該是這樣的

@interface iGamerFMViewController : UIViewController 

,或者如果它不確實iGamerFMViewController有一個名爲view

附註屬性 - 班通常與開始大寫字母表明它是一個類而不是變量或方法。

此外,您通常會在.m文件中執行您的#import "iGamerFMStreamingViewController.h",否則編譯器必須讀取整個類,而不僅僅是它的標題。

2

確保您爲視圖控制器選擇了正確的類。

enter image description here

相關問題