解决flutter desktop 网络请求失败

1,969 阅读1分钟

flutter笔记汇总

使用了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>