2012-06-29 80 views
-1

我正在做一个IOS应用程序,并从didFinishWIthLaunchingWithOptions返回后,应用程序冻结。IOS应用程序冻结后didFinishWithLaunchingWithOptions

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

{ 



self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
// Override point for customization after application launch. 


self.viewController = [[FooPlatformViewController alloc] init]; 

self.window.rootViewController = self.viewController; 
[self.window makeKeyAndVisible]; 

//Set to interactive mode 
[self.viewController.motionController setInteractiveMode:TRUE]; 
[self.viewController.motionController recoverSML]; 
[self.viewController.motionController startRecording]; 

return YES; 

}

检查在那里所有的变量使我相信一切正常。我在输出中看不到任何错误或消息。但是,函数返回后,应用程序冻结。

我注意到了这个冻结的一些奇怪的事情。首先,当我在冻结期间暂停执行,该应用程序有一个调用堆栈看起来像:

mach_msg_trap

mach_msg

主要

没有我的代码在那里,一直回到我的单线主。

接下来,此冻结只发生在运行iphone的模拟器。 iPad的模拟器工作正常,因为把应用程序放在手机上并运行该应用程序

任何想法?谢谢!

+0

发布**'didFinishWIthLaunchingWithOptions' **中的代码。您很可能试图访问已发布的内容。你在使用ARC吗? – WrightsCS

+0

ARC打开。 – Tyler

+0

您是否改变过'application:didFinishLaunchingWithOptions'?如果是这样,你可以发布代码吗?谢谢。 – pasawaya

回答

0

您的代码看起来好像没什么问题, 也许问题就在这里的某个地方

//Set to interactive mode 
[self.viewController.motionController setInteractiveMode:TRUE]; 
[self.viewController.motionController recoverSML]; 
[self.viewController.motionController startRecording]; 

我认为,在Xcode犯规支持加速度计,麦克风和摄像头默认的模拟器。可能访问任何这些可能会导致冻结。我记得在模拟器上访问摄像机时崩溃了。

虽然它不奇怪,你不会在iPad模拟器上崩溃。这只是我的猜测。