![]() ![]() ![]() ![]() |
|||||
|
|||||
樓主 阿醜 ![]()
![]() |
上網查了一下,好像是安全性的問題,說在 info.info.plist 加上 <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key><true/> </dict> 但我加了也沒用,請問這是怎麼回事 求大大解 |
1樓
最有價值解答
daisuke ![]() |
沒錯, 加那個就可以了。
問題出在判斷式, 你是想要判斷沒有 "http://" 就幫字串加上去吧? 所以要加上 "!" 在 str!.hasPrefix("http://") 前面。 要是原來狀況的話會是判斷有 "http://" 的字串, 再幫字串加上 "http://"。 if !str!.hasPrefix("http://") { str = "http://" + str! }
本篇文章回覆於2015-12-07 10:53
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
2樓 |
單加 ! 不能配適 htttps 這個字串, 所以可能需要判斷兩種。
例如判斷 "http://", "https://" 都沒有就加上 "http://" if !str!.hasPrefix("http://") || !str!.hasPrefix("https://") { .... }
本篇文章回覆於2015-12-07 11:01
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
3樓 |
更正是 && @A@
本篇文章回覆於2015-12-08 10:17
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
回覆 |
如要回應,請先登入. |