0
我有一个iOS应用程序可用在Appstore中。今天我测试了应用程序,它在我的iPhone4(iOS7)上崩溃,当应用程序尝试打开错误对话框时。在iPhone5上没有问题。应用程序崩溃只与商店应用程序'NSInvalidArgumentException'
当我从XCode安装应用程序时,它可以工作... XCode/Appstore是相同的版本。 我在XCode中读取控制台以找出应用程序崩溃的原因。我得到这个错误:
following error: : *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target
我在做什么错了? 当我打电话给我的errordialog我这样做:
self.showAlert("Error.", message: "Wrong credentials.", owner: self);
错误方法:
func showAlert(title:NSString, message:NSString,owner:UIViewController) {
if let gotModernAlert: AnyClass = NSClassFromString("UIAlertController") {
var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert);
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil));
owner.presentViewController(alert, animated: true, completion: nil);
}
else {
let alertView = UIAlertView(title: title, message: message, delegate: self, cancelButtonTitle: nil, otherButtonTitles: "OK");
alertView.alertViewStyle = .Default;
alertView.show();
}
}
问候
我已经实现了版本检查。当我不使用商店中的应用程序时,它就可以工作。就在我从商店使用它的时候。我认为这张支票不会帮助我,或者? – BHuelse
尝试至少一次,它可以帮助你。我认为检查的条件是错误的。 – poojathorat
但它真的很难测试...当我使用商店版本时,应用程序崩溃。从XCode加载一切工作完美... – BHuelse