Table of contents
Open Table of contents
1. IPhone真机运行异常:无法打开“iproxy”,因为无法验证开发者
sudo xattr -d com.apple.quarantine {flutter路径}/bin/cache/artifacts/usbmuxd/iproxy
2. MacOS上HTTP请求错误: Operation not permitted
MacOS默认在沙盘中运行app,需要添加权限。 在 /macos/Runner/DebugProfile.entitlements和Release.entitlements中添加
<key>com.apple.security.network.client</key>
<true/>
3. http包返回中文乱码问题
在使用http包时,返回结果的中文是乱码,需要多一层解码
final response = await _httpClient.post(
Uri.parse("${HttpConfig.apiUrl}auth/login"),
headers: {"Content-Type": "application/json"},
body: jsonEncode(passwordLogin.toJson()),
);
final result = Result.fromJson(jsonDecode(const Utf8Decoder().convert(response.bodyBytes)));