Reputation: 2317
I have this app, originally written for iOS 2.x. I recently needed to add a small feature, and was forced to make the app, that survived many iOS upgrades without any problem,iOS5 compliant. Only after testing and submitting the app, I got reports from the 300.000+ user base, that the app doesn't work on second generation iPod Touch with iOS 4.2.1. I tested on the first gen iPod touch, and that ran just fine. Interestingly, now that I finally found a sec gen iPod, in debug mode on the device, the app is just running fine. Only when I sync an AdHoc through iTunes, I get the same symptoms as those who downloaded the app through the App Store: A UIImageView loads an image, but after a few seconds, the image just disappears, leaving me with a blank screen.
What is the best way to figure out, where in the code things go wrong?
Thanks for your help
UPDATE: I have asked Apple to help me out here as well. This is so far the relevant part of the correspondence:
"Usually problems that only show up on the store or during review are caused by differences in how Xcode is configured to build your app in Debug vs Release (aka the build configuration used to submit to the store).
To be sure you're testing the exact build of the app that you submit to the App Store, you can create an Archived build, that you can both test, and submit. In Xcode 4, Product -> Archive will archive a build of your app into the Organizer window.
You can test that build by "Sharing…" it with yourself as an IPA, from the Organizer window in Xcode, and then installing the IPA with iTunes.
(Just FYI: "Share…"ing an archived build that you install with iTunes is the preferred way to test an app. Xcode installs apps in a slightly different way than the App Store. This is good during development, because it's faster. But for final testing, installing through iTunes is closest to what a user will experience.)"
and:
"So my advice would be to place asserts in places in your code that you "think" are suspicious. Place several NSLog statements within your code monitoring progress and perhaps outputting info like your UIImageView's frame size, etc."
While I do understand that this apparently is the only way to go, I'm a bit shocked by the meaning of this all:
As a developer you should own and test any combination of device and OS or just throw it at your customers and see where things go wrong.
Upvotes: 3
Views: 2561
Reputation: 584
I had a similar problem: runs fine in development, but the Product/ Archive/ Distribute/ Ad Hoc ipa file does not run correctly. Thanks to @CornPuff I started digging into my CoreData stuff and solved it:
I had some code like this:
dbMethods * myDbMethods = [[dbMethods alloc] init];
aUser *local_db_user = [myDbMethods getTopRecord];
if (local_db_user != nil) {
lbl_user_name.text = [NSString stringWithFormat:@"Welcome %@", local_db_user.user_name];
In development that always put something like Welcome John Smith in the label. In the Archive file always put Welcome (null) in the label. NOTE: the NSManagedContextObject was created in the getTopRecord method.
I had to create the NSManagedObjectContext object, myDb, in the method where I needed my aUser; send that to the method, which I now called, getTopRecordSafe
NSManagedObjectContext *myDb = [[[dbManager alloc] init] getManagedObjectContext];
dbMethods * myDbMethods = [[dbMethods alloc] init];
aUser *local_db_user = [myDbMethods getTopRecordSafe: myDb];
if (local_db_user != nil) {
lbl_user_name.text = [NSString stringWithFormat:@"Welcome %@", local_db_user.user_name];
Finally, I found this article helpful in understanding(?) why this happens. Objective-C is a C language of course.
If anyone knows of a checkbox in Xcode, or Jetbrain's AppCode, or any other iOS IDE, that says Create and run the same file that you'll be sending to Apple, here in development please let us know. :-)
Upvotes: 0
Reputation: 1924
I just ran into a similar problem. It turns out I was mixing and matching NSManagedObjectContext objects. I have no idea why this worked in the debugger, and broke when I launched from springboard.
I was able to debug the app that I started in the simulator by using "Product->Attach to Process" in Xcode.
Hope that helps someone else.
Upvotes: 1
Reputation: 27147
I don't recall where, but I have heard of this issue with UIImageView
before. As I recall the problem was they were instantiating the UIImage
on a background thread. Since NSLog()
affects threading I could imagine that in debug mode with logs in use that any il affects of the multithreading may be mitigated. However in release mode the log statements are stripped the error can occur.
Upvotes: 1