我正在实施一个voip应用程序,但我在autorestart中遇到了一个小问题: - 打开设备时,应用程序会自动启动 但: - 用户从底栏中杀死应用程序后,应用程序不会重新启动。
我做错了什么,或者有没有办法强迫它自动重启?或者也许是一种设置退出代码的方法?
感谢。
'代码'
[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 selector: @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;