支付中心
iOS SDK 要求 iOS 8.0 及以上版本
iOS 9 以上版本如需使用支付宝和微信渠道,需要在 Info.plist
中添加以下代码
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>wechat</string>
<string>alipay</string>
<string>alipays</string>
<string>mqq</string>
</array>
iOS 9 对 http 协议的访问进行了限制,如果 App 需要访问 http://
,需要在 Info.plist
中添加如下代码
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
在 AppDelegate 中编写回调方法
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
let annotation = options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! NSString
if(annotation .isEqualToString("com.tencent.xin")){
return WXApi.handleOpenURL(url, delegate: TeldPayManager.sharedManager())
}else if(annotation .isEqualToString("com.alipay.iphoneclient")){
AlipaySDK .defaultService().processAuthResult(url, standbyCallback: { (dic) -> Void in
})
}
return true;
}