简体   繁体   中英

My iOS app works in simulator but instantly crashes when I try to open it on my phone

[EDIT] Possible fix: my ipa was unsigned, I bought a Developer's account and will test tomorrow with a signed .ipa. [/EDIT] This is my second app. It's very simple, all it does is send a post request to my server, and display a response. It works perfectly on the iOS simulator on Xcode, but when I push the ipa to my phone, it just crashes. A friend of mine also tested it, and the same happened. Can you please take a look at the code? It's not that long: https://drive.google.com/file/d/0ByoF_XNJWlVyeHJHdHp3LVdTS3c/view?usp=sharing Here's the ipa: https://drive.google.com/file/d/0ByoF_XNJWlVyeGJrNldMb1BPMVE/view

I also can't/don't know how to get a crash report for the app on my phone, so if you need that I'd need help on how to get it too.

Thanks in advance!

在此处输入图片说明 It would be helpful if you could paste the crash report, you can connect your device and debug it for the same.

Possibility is : You might have built your app using iOS SDK 8.0 or above and trying to run it on a lower version. Also, to make it compatible with your device you need to avoid using methods that are introduced in iOS8.

Add this before you make post request to check if the internet is connected or not ..

NSURL *scriptUrl = [NSURL URLWithString:@"http://www.google.com"];
NSData *data = [NSData dataWithContentsOfURL:scriptUrl];
if (data){
    [self yourPostMethod];
}

else{
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Network not Reachable" message:@"Please check your internet connection!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

        [alert show];
}

As you have mentioned you have developed app using Xcode 5.1 and deployment target to 7.1 .
If you want to make sure it should work onlatest versions, you need to update your xcode and set base sdk to latest and deployment target you can set 7.0

购买开发者帐户解决了我的问题。

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