用delphi xe 开发的iphone app, 在iphone升级到ios 9以后,出现一些奇怪的错误,原有的http请求都失败。查了资料后才知道ios 9会强制所有的app中原有的http请求变为https请求。如果原有的服务器部不支持https的话,就会出现各种错误。
解决办法:修改源程序所带的xxx.info.plist文件,来关闭ios 9强制https的功能,让针对app的http请求恢复。
从源程序的release或debug目录下找到xxx.info.plist (xxx为app的名字). 打开后加入(红色为加入的部分)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<!--Connect to anything (this is probably BAD)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleName</key>
<string>STApp</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>STApp</string>
重新运行程序,部署app到iphone后,运行正常!

本文介绍了解决iOS9升级后导致使用Delphixe开发的iPhone应用中HTTP请求失败的问题。通过修改info.plist文件,禁用iOS9的HTTPS强制功能,使应用恢复正常。

被折叠的 条评论
为什么被折叠?



