应用程序在设备上崩溃但不在模拟器中崩溃

时间:2012-03-07 21:09:05

标签: ios5 xamarin.ios monotouch.dialog

我有一个调用Web服务的应用程序。它在模拟器中运行良好但在设备上崩溃。当我调试第一次访问Web服务时发生崩溃。以下是我得到的信息:

3月7日15:58:52 Justins-iPhone SpringBoard [15]:我的应用程序无法及时发布

3月7日15:58:52 Justins-iPhone SpringBoard [15]:强制MyApp崩溃报告[112] ......

Mar 7 15:58:52 Justins-iPhone SpringBoard [15]:完成崩溃报告。

3月7日15:58:52 Justins-iPhone com.apple.launchd [1](UIKitApplication:我的应用程序[0xc356] [112]):( UIKitApplication:我的应用[0xc356])已退出:已杀:9

Mar 7 15:58:52 Justins-iPhone SpringBoard [15]:应用程序“我的应用程序”异常退出,信号9:已杀:9

Mar 7 15:58:52 Justins-iPhone ReportCrash [113]:使用uid将崩溃报告保存到/var/mobile/Library/Logs/CrashReporter/MyApp_2012-03-07-155852_Justins-iPhone.plist:0 gid:0 ,synthetic_euid:501 egid:0

非常感谢任何帮助,我不知道发生了什么。

2 个答案:

答案 0 :(得分:1)

不要在主线程中执行阻塞任务,使用异步或新线程。问题是您在呈现第一个视图之前轮询Web服务。这会导致您的应用开始超时,而ios会终止您的流程。

Mar 7 15:58:52 Justins-iPhone SpringBoard[15] : My App failed to launch in time

答案 1 :(得分:1)

如果您在AppDelegate中的FinishedLaunching中调用此服务,并且需要超过17秒的时间,设备将终止您的应用程序。

一般来说,任何IO绑定任务(如Web服务)都应该卸载到后台线程:

_client = new ServiceClient();
_client.DoSomethingCompleted += Handle_DoSomethingCompleted;
_client.DoSomethingAsync();

在模拟器中可能会或可能不会执行这些相同的限制。

相关问题