英文:
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 '../../../.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>
# 答案1
**得分**: 1
看起来您没有读取`http.dart`文件的权限,您可以尝试以下方法:
1. 修改`.pub-cache`目录的权限以进行读写。在终端中运行以下命令:
```shell
sudo chmod -R 777 ~/.pub-cache
- 删除
.pub-cache
目录,然后重新运行flutter pub get
命令以重新下载依赖项:
rm -rf ~/.pub-cache
flutter pub get
- 将您的终端或 iTerm2 应用程序添加到
完全访问
列表中,如果您使用这些应用程序运行 flutter 应用。
英文:
It seems like that you don't have permission reading http.dart
file, you can try the following methods:
- 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
- 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
- Add your Terminal or iTerm2 App to
Full Access
list, if you use these to run flutter app.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论