2011-07-07 7 views
1

iPhone 3.1.3で実行できるアプリケーションを開発するためにXCode 4を使用しています。 iOS4 Simulatorでは正常に動作しますが、デバイス上でエラーが発生します。iPhone 3.1.3にデプロイされたiOS 4.3 SDKのエラー

これはAppDelegateコードでエラーが発生します。

@implementation VoConstructorAppDelegate 


@synthesize window=_window; 

@synthesize viewController=_viewController; 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    // Override point for customization after application launch. 

    self.window.rootViewController = self.viewController; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 

私はself.window.rootViewController = self.viewController;で次のエラーを取得する:

2011-07-07 15:10:20.997 VoConstructor[159:207] *** -[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x11a9e0 
2011-07-07 15:10:21.053 VoConstructor[159:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x11a9e0' 

任意のアドバイスはありますか?

答えて

5

rootViewControllerプロパティがiOS4.0のUIWindowにのみ表示されたため、古いプラットフォームでは使用できません。 iOS 3.xでは、コントローラのビューをUIWindowに手動で追加する必要があります。

if ([self.window respondsToSelector:@selector(setRootViewController:)]) 
    self.window.rootViewController = self.viewController; 
else 
    [self.window addSubview:self.viewController.view]; 
関連する問題