views:

171

answers:

2

I'm creating iphone app. In that, when the app starts, it connects to server and downloads few images and then proceeds with app. When app is downloading, it will show the initial splash screen. as long as my server is able to ping my iphone, its working well. but the trouble starts when my server is taking much time to respond for the NSURL request. The app is crashing with following error:

Mon May 14 13:56:34 unknown Springboard[24] <Warning>: com.xxxx.xxx failed to launch in time

I understood that when such issues happen with application, iphone crashes the appliation. I would like to know how much max time iphone allows app to respond to such instances.

Is there any max value for that?

A: 

The timer is something like 20-30 seconds, but that's not important.

You are downloading data synchronously. Please change your program to download asynchronously, using NSURLConnection. Your app will seem much faster and won't run the risk of termination. You can also implement error handling for timeouts.

Paul Lynch
A: 

From the Readme.txt on Apple's Reachability example:

The Reachability sample demonstrates the asynchronous use of the SCNetworkReachability API. You can use the API synchronously, but do not issue a synchronous check by hostName on the main thread. If the device cannot reach a DNS server or is on a slow network, a synchronous call to the SCNetworkReachabilityGetFlags function can block for up to 30 seconds trying to resolve the hostName. If this happens on the main thread, the application watchdog will kill the application after 20 seconds of inactivity.

As Paul says, it is a very, very bad idea to do any sort of synchronous networking. You need to do this loading asynchronously on the iPhone.

Brad Larson