flutter 网络请求失败
请求百度如下错误
SocketException: Connection failed (OS Error: Operation not permitted, errno = 1), address = www.baidu.com, port = 443
处理方式
- 使用了dio,模拟器和web都没问题,只有desktop不能调接口
- 需要在macos/Runner/DebugProfile.entitlements文件中添加com.apple.security.network.client。
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
本文来自博客园,作者:vx_guanchaoguo0,转载请注明原文链接:https://www.cnblogs.com/guanchaoguo/p/17798357.html