I'm implementing a voip application but I'm having a small problem with autorestart: - the app is automatically started when the device is turned on BUT: - the app does not restart after the user kills it from the bottom bar.
Am I doing something wrong, or is there any way to force it to autorestart ? Or maybe a way to set the exit code ?
Thanks.
'code'
[window addSubview:mainViewController.view];
[window makeKeyAndVisible];
g_mainApp = self;
_site = false;
[StoreManager sharedManager];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handlePayment:) name: kProductFetchedNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handlePayment:) name: kInAppPurchaseManagerBuyNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self se开发者_StackOverflow社区lector: @selector(handlePayment:) name: kInAppPurchaseManagerTransactionFailedNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handlePayment:) name: kInAppPurchaseManagerTransactionSucceededNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handlePayment:) name: kInAppPurchaseManagerTransactionCanceledNotification object: nil];
[mainViewController FirstInit];
int cnt = 0;
while (cnt < 140)
{
if ([mainViewController GetConnex] != 0)
break;
[mainViewController Update];
[NSThread sleepForTimeInterval:0.1];
cnt++;
}
return YES;
精彩评论