用 dio 请求后端接口

在模拟器一切正常,到真机提示如下:
DioExceptionType.connectionError The connection errored:Connection failed This indicates an error whichmost likely cannot be solved by the library.

是 dio 的问题吗?接口是 http://ip:port 的形式


已经在 info.plist 里申明了 http 放行
    <key>NSAppTransportSecurity</key>
    <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
        </dict>
举报· 67 次点击
登录 注册 站外分享
1 条回复  
whevether 小成 2024-8-19 09:34:48
真机是正式打包还是调试开发模式。调试模式没问题。但是正式打包 ios 不管你是不是开了这个允许安全都无效。因为你这个是 app 允许 http ,而 ios 系统强制需要 https 会被 ios 屏蔽。
返回顶部