Fencer04
Fencer04

Reputation: 1123

App Crashes On Device But Not In Simulator

I have an application that calls out to a web service. It runs fine in the emulator but crashes on the device. When I debug the crash happens when accessing the web service for the first time. The following is the info that I get:

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

Mar 7 15:58:52 Justins-iPhone SpringBoard[15] : Forcing crash report of MyApp[112]...

Mar 7 15:58:52 Justins-iPhone SpringBoard[15] : Finished crash reporting.

Mar 7 15:58:52 Justins-iPhone com.apple.launchd[1] (UIKitApplication:My App[0xc356][112]) : (UIKitApplication:My App[0xc356]) Exited: Killed: 9

Mar 7 15:58:52 Justins-iPhone SpringBoard[15] : Application 'My App' exited abnormally with signal 9: Killed: 9

Mar 7 15:58:52 Justins-iPhone ReportCrash[113] : Saved crashreport to /var/mobile/Library/Logs/CrashReporter/MyApp_2012-03-07-155852_Justins-iPhone.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0

Any help would be greatly appreciated, I have no idea what's happening.

Upvotes: 1

Views: 236

Answers (2)

Anuj
Anuj

Reputation: 3134

If you make a call to this service in FinishedLaunching in the AppDelegate and it takes longer than ~17 seconds the device will kill your application.

Generally speaking any IO bound tasks such as web services should be offloaded to a background thread:

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

Those same restrictions may or may not be enforced in simulator.

Upvotes: 1

j_mcnally
j_mcnally

Reputation: 6958

Don't do blocking tasks in the main thread, use async or a new thread. The problem is you're polling a webservice before the first view is rendered. This causes your app start to time out and ios will kill your process.

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

Upvotes: 1

Related Questions