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

丶灬走出姿态 提交于 2019-12-10 18:53:03

问题


when i launch my application in iphone emulator, it goes without any problem. If i launch on device it will crash as still as i open it. But when i launch emulator it says that problem:

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

What can i do? This is my application delegate:

.h :

#import <UIKit/UIKit.h>

@class TrovaChiaviViewController;

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

and this is .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:


I don't see where you are setting your viewController property, add

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

before

self.window.rootViewController = self.viewController; 



回答2:


I just had this issue when I was changing the application from iPhone only to iPad. The error message "Applications are expected to have a root view controller at the end of application launch" was happening because in the application-info plist, there was an entry specifying a nib file for MainWindow when I was no longer using a nib.




回答3:


Although this is an older thread, I thought I'd contribute. Sometimes I select a template when creating new projects. There were two cases when I created empty projects. In both of these cases, I encountered the same problem.

Refer to this link. http://www.mumuen.com/2011/09/applications-are-expected-to-have-root.html

In my case, the key was that I had failed to allocate space for both my window and root controller.



来源:https://stackoverflow.com/questions/8054706/applications-are-expected-to-have-a-root-view-controller-at-the-end-of-applicati

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!