Flutter XCode 权限被拒绝

huangapple go评论69阅读模式
英文:

Flutter XCode Permission Denied

问题

每当我运行项目时,都会出现这个错误,显示权限被拒绝:

Running pod install...
Running Xcode build...
Xcode build done.                                           37.3s
Failed to build iOS app
Error (Xcode): ../../../.pub-cache/hosted/pub.dev/facebook_auth_desktop-0.0.9/lib/src/custom_http_client.dart:3:8: Error: 
Error when reading '../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/http.dart': Permission denied

Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.```

<details>
<summary>英文:</summary>

Whenever I run the project I get this error saying permission denied
```Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                           37.3s
Failed to build iOS app
Error (Xcode): ../../../.pub-cache/hosted/pub.dev/facebook_auth_desktop-0.0.9/lib/src/custom_http_client.dart:3:8: Error: 
Error when reading &#39;../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/http.dart&#39;: Permission denied

Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.```

</details>


# 答案1
**得分**: 1

看起来您没有读取`http.dart`文件的权限,您可以尝试以下方法:

1. 修改`.pub-cache`目录的权限以进行读写。在终端中运行以下命令:
```shell
sudo chmod -R 777 ~/.pub-cache
  1. 删除.pub-cache目录,然后重新运行flutter pub get命令以重新下载依赖项:
rm -rf ~/.pub-cache
flutter pub get
  1. 将您的终端或 iTerm2 应用程序添加到完全访问列表中,如果您使用这些应用程序运行 flutter 应用。
英文:

It seems like that you don't have permission reading http.dart file, you can try the following methods:

  1. Modify the permissions of the .pub-cache directory to read and write. Run the following command in a terminal:
sudo chmod -R 777 ~/.pub-cache
  1. Delete the .pub-cache directory, and then re-run the flutter pub get
    command to re-download dependencies:
rm -rf ~/.pub-cache
flutter pub get
  1. Add your Terminal or iTerm2 App to Full Access list, if you use these to run flutter app.

huangapple
  • 本文由 发表于 2023年6月26日 00:21:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76551379.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定