[英]how to connect from my iphone to my localhost on my mac os
i read many questions about it, but still i have problem. 我读了很多关于它的问题,但仍然有问题。
when i was using localhost and correct NSAppTransportSecurity optinos from my simulator, everything was correct. 当我使用localhost并从模拟器中更正NSAppTransportSecurity optinos时,一切都正确。
now i am debuging on my iphone. 现在,我正在使用iPhone进行调试。 both the iphone and the mac are connecting to the same network.
iPhone和Mac都连接到同一网络。
i check the ip address of my mac 我检查了我的Mac的IP地址
and i added it to NSAppTransportSecurity like this: 我将其添加到NSAppTransportSecurity中,如下所示:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>10.250.x.x</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
i am still getting error: 我仍然收到错误:
App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
error = Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x7f904d300170 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://10.250.x.x:8080/IVRServer/api/registration/register, NSErrorFailingURLKey=http://10.250.x.x:8080/IVRServer/api/registration/register, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
should i add anything else to my plist? 我应该在我的列表中添加其他内容吗?
please don't consider this quesitn duplicated because i am already using the correct settings in my plist, and it is working fine, but just when i change the server to not localhost it is not working 请不要考虑重复此问题,因为我已经在我的plist中使用了正确的设置,并且工作正常,但是当我将服务器更改为非本地主机时,它却无法工作
what am i missing? 我想念什么?
If you just want to bypass this restriction, allow all loads: 如果只想绕过此限制,请允许所有负载:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
This should be feasible because presumably you are using your "local host" so there should not be any security concerns. 这应该是可行的,因为大概您正在使用“本地主机”,因此不会有任何安全问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.