[Objective-C]应用程序被期望有一个根视图控制器应用发射 wait_fences 月底︰ 未能收到回复︰ 10004003

发布时间: 2016/9/21 6:19:29
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

当我启动我的应用程序在 iphone 模拟器,它就没有任何问题。如果我启动设备上,它将作为崩溃仍然为我打开它。但当我启动仿真程序时它说,这一问题︰

Applications are expected to have a root view controller at the end of application launch
wait_fences: failed to receive reply: 10004003

我可以做什么? 这是我的应用程序委托︰

.h:

#import <UIKit/UIKit.h>

@class TrovaChiaviViewController;

@interface TrovaChiaviAppDelegate : NSObject <UIApplicationDelegate>
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet TrovaChiaviViewController *viewController;
@end

这是.m

#import "TrovaChiaviAppDelegate.h"
#import "TrovaChiaviViewController.h"

@implementation TrovaChiaviAppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{

}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [application release];
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{

}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
}
- (void)applicationWillTerminate:(UIApplication *)application
{

}
- (void)dealloc
{
    [_window release];
    [_viewController release];
    [super dealloc];
}

@end

解决方法 1:

我不明白您在其中设置你 viewController 属性,添加

self.viewController = [[[TrovaChiaviViewController alloc] initWithNibName:@"TrovaChiaviViewController" bundle:nil] autorelease];

之前

self.window.rootViewController = self.viewController; 
官方微信
官方QQ群
31647020