在我当前的应用程序中,我使用 foursquare api 显示附近的地点列表。它在当前应用程序中完美运行,直到 iOS 8.4。
但是当我将我的设备升级到 iOS 9 开发者版本时。当我试图获取附近的 field 时,它向我显示了类似
的错误Request ------- curl -X GET 'https://api.foursquare.com/v2/venues/search?client_secret=XXXX&limit=50&client_id=XXXX&ll=23.034048%2C72.510689&v=201509252&radius=804', [The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.foursquare.com” which could put your confidential information at risk.]
Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.foursquare.com” which could put your confidential information at risk." UserInfo={NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.foursquare.com” which could put your confidential information at risk., NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSUnderlyingError=0x16ff85c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.foursquare.com” which could put your confidential information at risk." UserInfo={NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.foursquare.com” which could put your confidential information at risk., _kCFNetworkCFStreamSSLErrorOriginalValue=-9813, _kCFStreamPropertySSLClientCertificateState=0, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9813, kCFStreamPropertySSLPeerTrust=, _kCFStreamErrorDomainKey=3, kCFStreamPropertySSLPeerCertificates={type = immutable, count = 2, values = ( 0 : 1 : )}, NSErrorFailingURLStringKey=https://api.foursquare.com/v2/venues/search?client_secret=XXXX&limit=50&client_id=XXXX&ll=23.034048%2C72.510689&v=201509252&radius=804
谁能建议如何解决这个问题?
仅供引用:我正在使用带有 UXRBaseNetworking 引擎的 foursquarekit。
我在检查他们的 foursquare 演示名称“Foursquare2”时也遇到了错误
错误是:
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
最佳答案
您需要将其添加到 plist 文件中:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
关于ios - 在 Foursquare api 中获取附近 field 在 iOS 9 测试版中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32472591/