【发布时间】:2014-04-25 08:58:29
【问题描述】:
我遇到了一个棘手的问题。
NSURL *url = [NSURL URLWithString:@"numberplate://"];
if([[UIApplication sharedApplication] canOpenURL:url]){
NSLog(@"it can");
}
只需创建一个空项目,将上面的代码插入到appdelegate.m中didFinishLaunchingWithOptions的方法中
我在模拟器上运行它,它运行正常。 我在我的设备上运行它,iOS 7.0.4,它崩溃了。
但我在其他人的设备上运行它,它运行正常。
所以,问题只是出现在我的设备上。
另外,如果我将字符串 @"numberplate://" 更改为任何其他字符串,它也可以正常运行。
有人遇到过这个问题吗?
==========添加编辑==============
@demosten
@try {
NSURL *url = [NSURL URLWithString:@"numberplate://"];
if([[UIApplication sharedApplication] canOpenURL:url]){
NSLog(@"success");
}
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
@finally {
NSLog(@"finally");
}
我像这样更改代码。但它无法捕获异常。
【问题讨论】:
-
什么是崩溃日志?
-
没有堆栈信息。只是有一个行指示器“EXC_BAD_ACCESS(code=1,address=0x442a6a0)”
-
您是否尝试过使用
@try @catch块? stackoverflow.com/questions/3363612/… 显示如何使用并提示如何在@catch处理问题之前避免调试中断 -
不是字符串(我在运行 iOS 7 的 iPod 上检查过)
-
卸载“车牌号”应用程序是否也会崩溃?