Search code examples
iphonexcodedistributiontestflight

iPhone 4 vs iPhone 5 TestFlight issue


Distributed a build through TestFlight. The ad-hoc build works fine on iPhone 5,but will open and then crash on iPhone 4 and 4s. If compiled and run through Xcode (directly to Phone with dev provisioning profile) the build runs on both iPhone 5, 4s and 4.

Has anyone ran into this?


Solution

  • The first thing to do debugging testflight errors (or any other, for that matter) is to get the error log, and read and understand the error message. In this case the error is:

    failed to launch in time
    

    If your app doesn't finish starting up (I believe this is essentially return from the application:DidFinishLaunchingWithOptions: method) in a certain amount of time, it's killed by the system. Either you have an infinite loop or you are trying to do way too much in that method. In this case, the app caches images in that method, which evidently is fast enough to finish in time on the iPhone 5 but not earlier ones. The solution is to queue a dispatch_async call (see Dispatch Queues) that caches the images in the background, and return quickly from the app launch method.