开发者社区 问答 正文

swift在使用flutter模块构建iOS本机应用程序时,修复权限被拒绝?

我创建了一个iOS单视图应用程序(hostapp),并将其转换为pod工作区。运行良好。然后创建flutter模块(clientapp),提供给iOS团队。独立运行良好。关闭hostapp和clientapp的Bitcode,因为它导致其他问题。现在通过podfile将clientapp添加到hostapp,内部代码没有更改。在hostapp中安装pod之后,我尝试构建它。然后它抛出/Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework: Permission denied

hostapp和clientapp都是默认的iOS和flutter应用程序。没有任何变化。 我遵循了此官方指南https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps。 试图寻找类似的问题,但没有成功。 在Xcode 10和11上测试 尝试过旧版 尝试过Xcode 11,10,9.3兼容等 将颤振chmod更改为777 将/Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/chmod 更改为777 PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Intermediates.noindex/hostapp.build/Debug-iphonesimulator/hostapp.build/Script-4899A4A5D85C0D737A68EFD6.sh (in target 'hostapp' from project 'hostapp') cd /Users/iVoIP/projects/xcode/hostapp /bin/sh -c /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Intermediates.noindex/hostapp.build/Debug-iphonesimulator/hostapp.build/Script-4899A4A5D85C0D737A68EFD6.sh

mkdir -p /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks rsync --delete -av --filter P .*.?????? --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/iVoIP/projects/xcode/hostapp/Pods/../../clientapp/.ios/Flutter/engine/Flutter.framework" "/Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks" building file list ... done Flutter.framework/ Flutter.framework/Flutter Flutter.framework/Info.plist Flutter.framework/icudtl.dat Flutter.framework/_CodeSignature/ Flutter.framework/_CodeSignature/CodeResources

sent 94440038 bytes received 120 bytes 188880316.00 bytes/sec total size is 94428117 speedup is 1.00 Stripped /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework/Flutter of architectures: armv7 arm64 Code Signing /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework with Identity - /usr/bin/codesign --force --sign - --preserve-metadata=identifier,entitlements '/Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework' /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework: replacing existing signature /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework: Permission denied Command PhaseScriptExecution failed with a nonzero exit code

展开
收起
被纵养的懒猫 2019-09-25 13:59:38 927 分享 版权
阿里云 AI 助理回答

遇到这种“Permission denied”错误,通常意味着Xcode在构建过程中没有足够的权限去修改或访问某些文件。尽管您已经尝试了使用chmod 777来增加Flutter框架的权限,但问题可能仍然存在,因为这不一定是权限设置的问题。以下是一些建议,希望能帮助解决您的问题:

  1. 清理缓存:有时候Xcode的DerivedData目录可能会包含旧的、损坏的构建产物。尝试清理 DerivedData 目录,可以通过以下步骤:

    • 关闭Xcode。
    • 在Finder中前往 ~/Library/Developer/Xcode/DerivedData 并清空该目录(可以先备份)。
    • 重启Xcode并重新构建项目。
  2. 检查Podfile.lock和Pods: 确保你的Podfile配置正确,并且所有依赖项都是最新的。有时候Podfile.lock中的依赖版本不匹配也会导致这类问题。可以尝试删除Podfile.lock和Pods目录,然后重新执行pod install

  3. Xcode Scheme设置:确保Xcode的Scheme设置正确,特别是对于新添加的Flutter模块。有时候需要手动编辑Scheme以确保所有必要的构建阶段都被正确配置。

  4. Code Signing问题:错误信息中提到“replacing existing signature”,这可能是代码签名环节出现了问题。确认您的Xcode项目以及CocoaPods的配置中代码签名设置是否一致且正确。尝试选择一个明确的开发团队和证书,而不是使用“-”作为Identity。

  5. Xcode权限问题:虽然您已经尝试过更改文件权限,但也可以检查整个项目的目录权限,确保Xcode有写入权限。可以在终端中使用sudo chmod -R a+rw /path/to/your/project命令,但请谨慎操作,避免对系统造成不必要的安全风险。

  6. Flutter Clean:在Flutter模块的根目录下运行flutter clean,清除Flutter的构建缓存,然后再尝试集成到iOS项目中。

如果以上方法都不能解决问题,建议查看Flutter和CocoaPods相关的官方论坛或者GitHub issue,看是否有其他开发者遇到类似问题并分享了解决方案。同时,确保您的开发环境(包括Xcode、Flutter SDK、CocoaPods等)都是最新版本,有时更新工具也能解决一些兼容性问题。

有帮助
无帮助
AI 助理回答生成答案可能存在不准确,仅供参考
0 条回答
写回答
取消 提交回答