简体   繁体   中英

App works in simulator and on testing device but crash after download from app store

I hav an app that i just did an update on and uploaded, everything worked great in the simulator and when testing on the device. However, when downloading from appstor it crashes in a specific situation.

I started a thread on finding the problem here: My app crash after downloading it from appstore now i need to solve this problem

The problem seems to be the following:

10  CoreFoundation  0x3614f4c4 +[NSException raise:format:] + 28
11  Foundation      0x34514e28 -[NSURL(NSURL) initFileURLWithPath:isDirectory:] + 68

However, the challenge is that i do not use "initFileURLWithPath" in my program so i do not know what to look for. I am looking at all the inits etc. but do not find anything that looks as a problem.

The things i changed from the previous version is:

  • New background graphics, added via xcode
  • A new quick game feature, which consist of a new button and a few new functions. I have checked them all.

The real issue here is how to find this as it is only when downloading from appstore it is a problem. BTW, i know that it crashes when i press the "wrong" button in my quizapp. That is good but i can still not figure out what is wrong.

Anyone that can give me some hints how to proceed with this weird problem and also explain how come something works perfectly on test device but not from appstore? BTW, how should i test this?

Thanks in advance :-)

====================================================================

I think i have found the problem. As i new when the crash occurred i checked that module and found something interesting. I then tested, on a live device, turning of the sound and the problem was gone. Turning on the sound resulted in a crash.

The code is:

if (sound == YES) {
    //==== PLAY THE LOOSING SOUND ====//
    // Form a URL to the sound file, which in init using the Path
    NSBundle *mainBundle = [NSBundle mainBundle];
    NSString *filePath = [mainBundle pathForResource:@"wrong2" ofType:@"wav"];
    NSURL *aFileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];

    // Create a sound ID, 
    SystemSoundID myID;
    // Register the sound
    AudioServicesCreateSystemSoundID((CFURLRef)aFileURL, &myID) ;
    // Play the sound!
    AudioServicesPlaySystemSound(myID);
}

The code line is:

NSString *filePath = [mainBundle pathForResource:@"wrong2" ofType:@"wav"];

What i do not understand is that the "wrong2.wav" exists in the resource folder but is still a problem?

====================================================

I just found that the "wrong2.wav" file was not present in the correct directory but still looked like it was correct in xcode4. I have copied a new version of the file to the correct directory, deleted the file in xcode and recopied it into xcode again.

Just do not know how to test.

=====Problem solved======= The problem was that i had imported the wav file from another directory rather than the one where the app was present in.

I can tell you I had similar experiences with graphics and uninitialised values. In the end I found that compiling in release mode, but using my development certificate allowed me to reproduce the problem on my device, and let me debug it. I soon found the error. Seemingly different libraries or optimisations are used for release mode compilation. I know make a habit of testing only when compiled under release mode, before submitting to the appstore.

I don't know what to suggest for your specific error however.

You may not be directly calling [initFileURLWithPath:] but are you loading files anywhere in your app using other method calls might be calling that ([UIImage imageNamed:] for example)? If that is the case, explore your compiled Release IPA (Right-Click, Explore package) and verify all the files you think should be there actually are.

If you are downloading files onto the device to be opened, verify that they are actually being downloaded from the server (perhaps the sim & your device are caching something).


One thing to keep in mind is that folders/groups in Xcode doesn't necessary reflect the folder structure of the project on your hard drive. Copy a an item into a Group in Xcode doesn't copy it to that folder.

Also, during the compile the entire folder hierarchy gets flattened, so in the MainBundle everything in the root (no folders), so keep that in mind when developing.

As for testing, have you tried completely removing the app from your device (and resetting the simulator) and re-adding it? When deploying, Xcode likes to take shortcuts and caches a lot of things so cleaning it out every now and then is a good thing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM