接着上篇的自定義URL scheme 在掛起和回調app的時候又遇到了問題、如下:
handleOpenURL && openURL的不同
handleOpenURL是其它應用通過調用你的app中設置的URL scheme打開你的應用、例如做分享回調到自己app就調用這個方法;
OpenURL是你通過打開一個url的方式打開其它的應用或鏈接、在支付或者分享時需要打開其他應用的方法。
Appdelegate.m中有多個handleopenURL,互相沖突,怎麼處理?
解決方法如下:先分開調用、在handleopenURL中nslog["%@", url ];獲取url的前綴
- (BOOL)application:(UIApplication *)application
handleOpenURL:(NSURL *)url
{
NSString *string =[url absoluteString];
if ([string hasPrefix:@"微博url的前綴"])
{
return [WeiboSDK handleOpenURL:url delegate:self];
}
else if ([string hasPrefix:@"微信的url的前綴"])
{
return [WXApi handleOpenURL:url delegate:self];
}
}