我有以下代码:
NSString *customURL = @"photo://";
NSURL *url = [NSURL URLWithString:customURL];
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
message:[NSString stringWithFormat:@"No custom URL defined for %@", customURL]
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
尝试使用自定义网址打开iPhoto应用。但代码返回错误消息并且未启动iPhoto。知道为什么会这样吗?
感谢您的帮助。
答案 0 :(得分:1)