iPhone 4 vs iPhone 5 TestFlight issue - iphone

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?

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.

Related

Xcode Instruments: Build to Profile hangs for large source code files

I am working on a iPhone app where I need to initialize large arrays. I use NSMUtuableArrays and all works fine when compiling normally. However, it takes forever to compile to iPhone compared to simulator. There is one particular file which has about 50-60k line.
Anyway, I also need to profile the memory and I always used Instruments in Xcode doing:
"Product" ->"build for profiling"
While I cannot get it to run on the iPhone at all, starting Instruments with this app even on the simulator in most cases it just hangs - even overnight.
Is there a better way to use Instruments or to handle such large source code files?
Many thanks

iPhone Dev, 3G Testing Device Launch Failures After App Rename and Upgrade to XCode 4

I have an iPhone app in the app store that I wanted to rename and make universal. I have done all the work for the rename (renamed the PRODUCT_NAME, not the binary identifier) and adding iPad support. Everything was running great on my iPad 2 (4.3.3) and my iPhone 4G (4.3.3). Before I packaged it up, I ran a test on my iPhone 3G (3.0).
I cannot get my app to launch properly on the 3G. When the app launches, the launch screen is displayed as it should be. The screen then goes to black with the status bar on the very top, like it has loaded a black nib or something. There are no error codes whatsoever -- nothing in the console, nothing in a pop up. The application does not even reach the "applicationDidFinishLaunchingWithOptions" method of my appDelegate. The application doesn't crash, either. It just sits there like it's waiting on input from a user, but like I said the application hasn't even finished launching.
The only things that have changed since the last time I tested on the old 3G (which was the last time I updated my app) are the application rename and the upgrade to XCode 4 w/base SDK 4.3.
In my XCode Scheme drop down, it does say: iPhone (3.0, Overriding Base SDK to 4.3). I don't know if that is inadvertently causing this hangup? I am running Xcode 4 with base SDK 4.3. The target deployment is 3.0.
Has anyone encountered anything like this? I would appreciate all insight and advice to the situation. So far I have deleted the application from my device, clean/build Xcode, delete Xcode build folder, delete and reinstall all provisioning profiles, reboot of device and XCode numerous times.
Thanks,
Brandie
As far as I have been able to determine the BEST solution (not the easiest) is to make a new project with the new project name and copy your files. Changing the PRODUCT_NAME gave me wierd results and I said "forget it, let's do it by the book".
If there is an easier solution, I have yet to find it and, frankly, given it takes me about 30 minutes (I've changed the name of an app 4 times - mostly because of name length), it causes me the least amount of grief.

huge size library not loading in iphone

I have ported a library (ice , NAT traversal ) for iPhone and encountering issue while actually testing it on iphone device(Version 4.3). Developed a cocoa touch wrapper which is linked with my library. The library routines get called from "test" button placed in my application.
The application is .mm and library is C++ based.
Below are the cases in which my application fails/passes
Case I: I "build and debug" / "build and run" application from Xcode for iphone. The application works fine on iphone and I am able to see logs for the same on the console on my mac machine.
Case II: I try to run application from my iphone, but it just crashes while opening.
Case III: I build and debug application from Xcode, the application get's launched. But as soon as i unplug the debug cable (attached to iphone from my mac), the application get's crashed.
The size of application is 16 MB, and size of library is 288 MB.
I tried to simulate same issue by making a simple test application and a test library. it runs fine in all cases without issues. What can be the issue?
It seems that the application is mapping library code from mac machine while running on iphone. and once the physical link is broken, the app crashes.
size of library is huge?
Thanks in advance
iOS kills apps that blocks the main thread for too long. So that may be the problem and also explains why the app doesn't get killed in debug mode.
Try running your function in the background and see if that helps!
Finally I got answer to my question! Thanks a lot Martin for pointing out "iOS kills apps that blocks the main thread for too long"
Following is the procedure i followed to find the resolve the issue:
Xcode "orgainzer"--> "Device logs" section shows iphone crash report. My application crash report was also generated in the same.
In crash report it was clearly written "mytestapp failed to launch in time" and further it showed the API which was taking too long to return the result. ( in my case it was getlocalhostname API).
I just corrected the API as per my requirement, compiled and run the app on iphone device and it worked!! Also the launch time of application is pretty less now.
Thanks again!

Unknown and unreproducible crash causes App Store rejection

After submitting our application several times, we continue to receive the following response:
Thank you for submitting My App to the
App Store. We've reviewed your
application and determined that we
cannot post this version of your iPad
application to the App Store because
My App is crashing on iPad running
iPhone OS 3.2 and Mac OS X 10.6.2. My
App crashes upon launch.
Unfortunately, crash logs have not
been generated.
However, resigning the same build with the AdHoc entitlements and loading the build onto the device yields no such crash. After a number of attempts, the application simply does not crash as reported by the reviewer. Furthermore, the reviewer does not provide any useful logging that may have been generated by SpringBoard such as an exit status or event if it had worked properly for any other device. There are no calls to explicitly exit or quit the application in the code line and yet the application terminates on startup.
What might cause an application to terminate in such a manner?
Under what conditions is an application tested that might not be found under a development environment?
Could it be a result of a signing issue that the submission validation system is simply unable to catch?
Thanks in advance.
After fighting with this for weeks, the application has finally been approved. The key: signing corruption. Hence why the application would start (or at least appear to start by showing the splash screen) and then suddenly vanish without a crash log. It failed Springboard's preflight sighing check.
A good tool to keep in mind to check for signing issues. It tells if the application has a valid signing:
codesign -vvvv MyApp.app
When I built the application, I would cp it to a network storage device where our product manager would pull it down and submit it to Apple. If decompressed on the NAS, the code signing was valid. But if you coped the compressed application back off the NAS and validate it, it would fail.
The lesson: make use of the new XCode utility to submit applications.
A few suggestions:
Try to use the leaks tool of the static analyzer to see if there are any memory leaks or problems your not seeing.
Does your app use a web service? This happened to me one time because the day Apple was reviewing the app the web service went down. That cause a crash. If thats the case you would want to add something to catch that.
Finally, In the logs Apple sent you did they send you the dsym file? If they did you can run atos from the command line and it will convert the address to symbols. That will show you what thread and symbol it's crashing on.
Be sure you test with a variety of settings: with Wifi disabled/enabled, with 3G disabled, Airplane mode on/off, location services disabled, etc.
As a last resort, assume there is a problem in your code that executes at startup. Remove half your startup code, set your release date in the far future (just in case it gets approved), then resubmit and see if they have the same problem. If not the problem is in the half you removed... it's a binary search.
I think you have two options: try harder to reproduce the defect using the tools other people are mentioning or to catch those crashes in the field.
PLCrashReporter will trap on an uncaught exception and store all relevant information. Next time your app is run, it can send the crash report that you can then symbolificate and view a stack trace of.
Ouch! That's a tough one. I've had this kind of thing happen before, but it seemed it was reproduce-able when I switched to a different device (iPhone 3G vs 3Gs, etc.). In your case though, it sounds like you're iPad only, so that might not help. There's a difference between 3G and Wifi, I suppose, but I would be really surprised if that was causing a crash on one and not the other.
One thing you could try if you think Apple's not doing their part is to change the binary name and re-submit it under another app name/record. See if you get the same response. If you get the same reviewer, you might, but I think there's a good chance you would get a different reviewer with a new app. Just set your app release date to some time in the distant future and it will never actually show up in the app store if they approve it. If the new app comes back rejected for the same reason, you've got work to do, but if they do in fact approve it, then I would get on the phone with them and point out the discrepancy.
My approach would be to make sure that the compilation is absolutely clean both in the static analyzer (this is NOT optional, it will save you time!) and for the build itself. Then set everything as described on CocoaDev' NSZombie page. Then make sure you have an iPod running 3.2 (actual hardware, not simulator) and test, test, test. Do it with network available and not available, with the device nearly full and freshly restored, every other variation you can think of. Run it with the debugger active and as a release build disconnected. Use Leaks, Instruments and all the other tools to peek in there and get a better feel for what is happening. If you exhaust every possibility you are going to have to beg for more detail from Apple but I bet you find a problem - one of the most important things in debugging an issue like this is to try to forget everything you think you know for sure and start at the beginning.

iPhone App fails to properly ??copy? database file ONLY with ad-hoc or app-store distribution and NOT in development mode

I just submitted this to Apple Support, but I'm wondering if anyone here has encountered something similar.
SUMMARY: my iphone app crashes when downloaded from the iTunes app store or from an ad-hoc distribution, but doesn't "crash" when run in debug mode on the simulator or on my iPod
DETAILS: The app contains a rather large sqlite database file (~180 meg uncompressed, 56 meg compressed). This may be relevant.
When launched, the application should copy the database (if necessary). After this, the user should be presented with a table-view containing approximately 6,000 rows. The information presented within these rows is derived from reading a table within the aforementioned database.
This all works properly when I run the application in the iPhone simulator and also when I run the application in debug mode on my iPod.
The app was approved by Apple. However, when users began to download the app through iTunes, I began receiving emails saying that the UITableView was not populated with any information. To investigate, I downloaded a copy of the app from the app store and I saw a similar result (i.e., UITableView is displayed, but the rows are empty).
I believe I am able to reproduce the problem using an ad-hoc distribution of my app.
The ad-hoc distribution behaves similarly (i.e. shows no rows in the UITableView) to the app-store download. Specifically, I have done the following multiple times (I delete and reinstall the application each time).
add my ad-hoc provisioning
certificate to iTunes
add my ad-hoc app build to iTunes
sync my iPod Touch with iTunes
start my ad-hoc app
app seems to always crash upon the first startup (i.e., the splash screen shows for a second and then I see the home screen of my iPod Touch)
second and subsequent start-ups of the ad-hoc app do not crash, but the UITableView is empty.
None of this happens when I run the app on the simulator or when I deploy in development/debug mode on the same iPod.
I have tried to examine crash logs associated with the initial crashing of the app (see step 5 above), but no crash log is created at that point in time. HOWEVER, a crash log is created when I sync iTunes with my iPod Touch, but it might as well be written in Polish.
So, it appears as though the app-store reviewers who approved my app only examined the behavior of the application using the simulator and/or in development/debug mode. It's possible that the issue is related to the large size of the database file, but this is complete speculation on my part. To the best of my understanding there should not be a limit on app-size or database size near 180 meg. This also wouldn't necessarily explain why the app works in debug/development mode.
Has anyone seen anything similar?
I think I figured this out (haven't tested it yet)...
Turns out the entire crash log isn't written in polish.
There's a part that says that the "application failed to launch in time"
I suspect that my database is too large to be copied during launch of the application.
to quote apple: ***iPhone OS uses a watchdog timer when applications are launched. If an application takes too long to complete its initial startup, the operating system terminates the application. Applications terminated for this reason will have the exception code 0x8badf00d and related information noted in the associated crash report:*
*When Xcode launches an application, the watchdog timer is disabled to compensate for additional overhead that may be incurred when Xcode attaches the debugger. As a result, your application's long startup may initially escape your attention if you are exclusively testing by running from Xcode.***