iOS9 微信支付支付寶支付適配

網上有相關文章,但不全,一方面是限制了http訪問,需要在info.plist中設置下:

<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>

另一方面,是界面跳轉,將要使用的URL Schemes設置爲白名單:

<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>alipay</string>
		<string>wechat</string>
		<string>weixin</string>
	</array>
這個微信的sdk 1.6更新了,其中說明文檔有說到,支付寶暫沒有找到。readme文件如下
重要!
SDK1.6
1、iOS 9系統策略更新,限制了http協議的訪問,此外應用需要在“Info.plist”中將要使用的URL Schemes列爲白名單,纔可正常檢查其他應用是否安裝。
受此影響,當你的應用在iOS 9中需要使用微信SDK的相關能力(分享、收藏、支付、登錄等)時,需要在“Info.plist”裏增加如下代碼:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>weixin</string>
</array>

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
或者配置白名單域名pingma.qq.com

2、開發者需要在工程中鏈接上 CoreTelephony.framework
3、解決bitcode編譯不過問題

另外,微信支付demo中有用到libsqlite3.dylib和libz.dylib,但是在xcode 7.0中找不到了,參考stackoverflow上的方法添加,能正常編譯(因爲之前找不到文件標紅,我刪了後編譯不通過),見鏈接:http://stackoverflow.com/questions/30815806/swift-2-ios-9-libz-dylib-not-found

I had the same problem. I found some kind of way around.

Go to Build Phases >Link Binary with Librairies > + > Add other
Once in the file selection window do "CMD"+Shift+G (Go to folder) and type /usr/lib/
From /user/lib you can add : libz.dylib and more...
Compile and have fun

大概就是這樣啦,現在支付寶和微信支付在iOS 9.0下都能正常使用

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章