app迭代新版本,发现从支付宝支付完成后,返回客户端的方法不执行了
//支付宝客户支付端回调函数 - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { //解析url,处理结果 [self parse:url application:application]; return YES; }
// 客户端回调接收方法 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [UMSocialSnsService handleOpenURL:url]; }
//1
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; // Will be deprecated at some point, please replace with application:openURL:sourceApplication:annotation:
//2 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation NS_AVAILABLE_IOS(4_2); // no equiv. notification. return NO if the application can't open for some reason
// Will be deprecated at some point, please replace with application:openURL:sourceApplication:annotation:
// 在某些时候,方法1将会被废弃,请用方法2代替。
那就用方法2代替吧,修改如下:
// 客户端回调接收方法,根据sourceApplication区别回调的应用,然后分区处理 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { if ([sourceApplication isEqualToString:@"com.alipay.iphoneclient"]) { [self parse:url application:application]; return YES; } else if ([sourceApplication isEqualToString:@"com.tencent.xin"]) { [self shareWX:url]; return YES; } return [UMSocialSnsService handleOpenURL:url]; }
原文地址:http://blog.csdn.net/hmxhh/article/details/42264065