简体   繁体   English

如何在Mac OS上从iPhone连接到本地主机

[英]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.

相关问题 如何在无法连接到Mac的iPhone上启动ios应用 - How to launch an ios app on an iphone that I cannot connect to my mac 在测试xcode应用程序时,如何让我的iphone连接到我的Mac上的本地Xampp服务器 - How do I get my iphone to connect to local Xampp server on my mac while testing an xcode app Xcode6中的iPhone Simulator发送Mac的OS版本 - iPhone Simulator in Xcode6 sends OS version of my Mac 如何将 IPA 文件从我的 iPhone 提取到 Mac? - How can I extract IPA file from my iPhone to Mac? 如何在Mac上托管基于节点的网站,并通过wifi从iPhone访问它? - How do I host a node based website on my mac and access it from my iPhone over wifi? 如何触发我的iphone应用程序从我的mac应用程序启动 - How can i trigger my iphone application to launch from my mac app 为什么我的 iPhone 无法连接到我的 Mac mini 共享的 ipv6 网络? - Why my iPhone can not connect to the ipv6 network which is shared by my Mac mini? Xcode 4:我的 iPhone 项目已成为 Mac OS 项目.. 我无法更改 - Xcode 4: My iPhone projects have become Mac OS projects.. and I can't change this iPhone如何在Mac中访问sqlite数据库 - how does iphone access sqlite database in my mac 如何将我的mac剪贴板中的东西粘贴到iPhone模拟器中? - How can I paste stuff from my mac's clipboard to the iPhone simulator?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM