fav*_*avo 4 iphone xcode objective-c url-scheme
我已成功将自己的网址方案添加到我的应用程序中.应用程序使用这些方案正确启动.
现在我想处理传入的数据,但不调用委托.它是一个通用的应用程序,我已经向AppDelegates添加了以下功能:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
if (!url) { return NO; }
NSString *URLString = [url absoluteString];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"test message", nil)
message:URLString
delegate:self
cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用如下模式进行测试:myapp://appalarm.com ...并且期望在URLString中成为appalarm.com
这有什么问题?
谢谢你的回复!
如果您的应用程序委托实现了'applicationDidFinishLaunchingWithOptions:',则永远不会调用'handleOpenURL:'方法.查看通过其他方法传递的选项,以确定应用程序的启动方式以及应实现的行为.