ios - 为什么在使用 flutter 模块构建 iOS 原生应用程序时要修复 "Frameworks/Flutter.framework: Permission denied"?

标签 ios swift xcode flutter cocoapods

我创建了一个 iOS 单 View 应用程序 (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:权限被拒绝

  • hostapp 和 clientapp 都是默认的 iOS 和 flutter 应用程序。没有任何变化。
  • 我遵循了这个官方指南 https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps .
  • 曾尝试搜索类似问题,但没有成功。
  • 在 Xcode 10 和 11 上测试
  • 尝试过旧版本
  • 尝试过 Xcode 11、10、9.3 兼容等
  • 将 flutter 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

最佳答案

在 Flutter 文件夹中的此路径中找到 xcode_backend.sh 文件 ‎flutter/packages/flutter_tools/bin 并在第 140 行将其更改为

    RunCommand find "${derived_dir}/engine/Flutter.framework" -type f -iname '.h' -exec chmod a-w "{}" \;

这样就可以了!!

关于ios - 为什么在使用 flutter 模块构建 iOS 原生应用程序时要修复 "Frameworks/Flutter.framework: Permission denied"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58091905/

相关文章:

swift - 为什么我应该使用 NSManagedObjectContext 的 Perform() 和 PerformAndWait() 而我可以使用 DispatchQueue.global

iphone - 当手绕传感器移动时,接近传感器打开

ios - Swift2 的数组

ios - 推送通知在配置文件中激活多长时间?

casting - 字典中包含的 AnyObject 类型的强制转换值

ios - @IBAction 递归调用

Swift:测试 Segue 是否存在,是否有正确的目的地并更改正确的内容

ios - 在实体异常中找不到 keypath objectID

swift - 根据 TableView 中的项目数使动态 UI 按钮出现和消失

ios - Xcode 5 配置文件不可用