iOS 支付寶或微信支付當支付成功後都會在AppDelegate中調用
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
這兩個方法進行回調操作,可是前段時間還好好的,這兩天就不能用了,經過一番查找得知
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
此方法成ios9中已過期,把回調放到新的代理方法中就可以了。
ios9中的方法:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{
if ([url.host isEqualToString:@"safepay"]) {
[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
NSLog(@"result = %@",resultDic);
}];
return YES;
}else{
return [WXApi handleOpenURL:url delegate:[WXApiManager sharedManager]];
}
}