Search code examples
objective-cuiviewcontrolleremulationuiapplicationdelegate

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


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

Solution

  • 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;