Flutter XCode 权限被拒绝

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

Flutter XCode Permission Denied

问题

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

  1. Running pod install...
  2. Running Xcode build...
  3. Xcode build done. 37.3s
  4. Failed to build iOS app
  5. Error (Xcode): ../../../.pub-cache/hosted/pub.dev/facebook_auth_desktop-0.0.9/lib/src/custom_http_client.dart:3:8: Error:
  6. Error when reading '../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/http.dart': Permission denied
  7. Could not build the application for the simulator.
  8. Error launching application on iPhone 14 Pro Max.```
  9. <details>
  10. <summary>英文:</summary>
  11. Whenever I run the project I get this error saying permission denied
  12. ```Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
  13. Running pod install...
  14. Running Xcode build...
  15. Xcode build done. 37.3s
  16. Failed to build iOS app
  17. Error (Xcode): ../../../.pub-cache/hosted/pub.dev/facebook_auth_desktop-0.0.9/lib/src/custom_http_client.dart:3:8: Error:
  18. Error when reading &#39;../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/http.dart&#39;: Permission denied
  19. Could not build the application for the simulator.
  20. Error launching application on iPhone 14 Pro Max.```
  21. </details>
  22. # 答案1
  23. **得分**: 1
  24. 看起来您没有读取`http.dart`文件的权限,您可以尝试以下方法:
  25. 1. 修改`.pub-cache`目录的权限以进行读写。在终端中运行以下命令:
  26. ```shell
  27. sudo chmod -R 777 ~/.pub-cache
  1. 删除.pub-cache目录,然后重新运行flutter pub get命令以重新下载依赖项:
  1. rm -rf ~/.pub-cache
  2. 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:
  1. 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:
  1. rm -rf ~/.pub-cache
  2. 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:

确定