如何在codemagic中创建podfile?

Obe*_*lve 5 ios flutter codemagic

我正在尝试使用 Codemagic 在 Windows 中构建 iOS Flutter 应用程序。我在 android studio 中创建了 flutter 项目并将其上传到 github 以便在 Codemagic 中使用它...但是当我尝试构建 iOS 应用程序时,Codemagic 向我抛出此错误:

\n
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.\nBuilding com.jmmago.saltApp for device (ios-release)...\nRunning pod install...                                             16.0s\nRunning Xcode build...                                          \nXcode build done.                                           124.3s\nFailed to build iOS app\nError output from Xcode build:\n\xe2\x86\xb3\n    ** BUILD FAILED **\n\n\nXcode\'s output:\n\xe2\x86\xb3\n    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/barcode_scan-3.0.1/ios/Classes/protos/protos.pb.swift:14:8: error: compiling for iOS 8.0, but module \'SwiftProtobuf\' has a minimum deployment target of iOS 9.0: /Users/builder/clone/build/ios/Release-iphoneos/SwiftProtobuf/SwiftProtobuf.framework/Modules/SwiftProtobuf.swiftmodule/armv7-apple-ios.swiftmodule\n    import SwiftProtobuf\n           ^\n    Command CompileSwift failed with a nonzero exit code\n    note: Using new build system\n    note: Building targets in parallel\n    note: Planning build\n    note: Constructing build description\n    warning: The iOS deployment target \'IPHONEOS_DEPLOYMENT_TARGET\' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target \'barcode_scan\' from project \'Pods\')\n    warning: The iOS deployment target \'IPHONEOS_DEPLOYMENT_TARGET\' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target \'sqflite\' from project \'Pods\')\n    warning: The iOS deployment target \'IPHONEOS_DEPLOYMENT_TARGET\' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target \'shared_preferences\' from project \'Pods\')\n    warning: The iOS deployment target \'IPHONEOS_DEPLOYMENT_TARGET\' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target \'path_provider\' from project \'Pods\')\n    warning: The iOS deployment target \'IPHONEOS_DEPLOYMENT_TARGET\' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target \'image_picker\' from project \'Pods\')\n    warning: The iOS deployment target \'IPHONEOS_DEPLOYMENT_TARGET\' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target \'MTBBarcodeScanner\' from project \'Pods\')\n    warning: The iOS deployment target \'IPHONEOS_DEPLOYMENT_TARGET\' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target \'FMDB\' from project \'Pods\')\n    warning: The iOS deployment target \'IPHONEOS_DEPLOYMENT_TARGET\' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target \'Flutter\' from project \'Pods\')\n\n\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\nBuilding a deployable iOS app requires a selected Development Team with a \nProvisioning Profile. Please ensure that a Development Team is selected by:\n  1- Open the Flutter project\'s Xcode target with\n       open ios/Runner.xcworkspace\n  2- Select the \'Runner\' project in the navigator then the \'Runner\' target\n     in the project settings\n  3- Make sure a \'Development Team\' is selected. \n     - For Xcode 10, look under General > Signing > Team.\n     - For Xcode 11 and newer, look under Signing & Capabilities > Team.\n     You may need to:\n         - Log in with your Apple ID in Xcode first\n         - Ensure you have a valid unique Bundle ID\n         - Register your device with your Apple Developer Account\n         - Let Xcode automatically provision a profile for your app\n  4- Build or run your project again\n\nFor more information, please visit:\n  https://flutter.dev/setup/#deploy-to-ios-devices\n\nOr run on an iOS simulator without code signing\n\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\nEncountered error while building for device.\n\n\nBuild failed :|\nFailed to build for iOS\n
Run Code Online (Sandbox Code Playgroud)\n

在这个问题中,他们通过创建 podfile 解决了同样的问题。但如何创建 Podfile?\n我必须在我的项目中创建它,然后将其推送到 github?或者有办法在 Codemagic 中创建它吗?

\n

Arn*_*ann 6

我认为在 VSCODE 中打开您的项目并将其所在的所有 3 个位置中的“IPHONEOS_DEPLOYMENT_TARGET”更改为 9.0 可能就足够了。此外,检查您的 AppFrameworkInfo.plist 文件并将 MaximumiOSVersion 设置为 9.0。

但是,如果您希望通过 Codemagic 创建 podfile,那么您可以尝试将其放入第一次运行的预构建脚本中(稍后将其删除):

cd ios && pod init && git add . && git commit -m "将 Podfile 添加到项目" && git Push

  • 当然,似乎确实存在一些访问问题,我认为最好的解决方案是使用“推送访问”将 Codemagic 部署密钥添加到您的存储库。将公钥添加到存储库“部署密钥”中,并将加密密钥添加到 UI 或 .yaml 中的环境变量中。将名称设置为 ACCESS_SSH_KEY - 确保它以 _SSH_KEY 结尾,这样 Codemagic 就会自动将其添加到您的密钥中。然后使用以下命令更改远程: git remote set-url origin <your SSH url> 在脚本之前。快速演示:https://www.youtube.com/watch?v=zDpLqDh1ETs (2认同)
  • 虽然也许更简单的方法是在 Github 上设置访问令牌:https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal- access-token 并将其添加到您的 ENV 变量中,然后您应该能够使用以下命令进行推送: git push "https://your-username:$APP_PASSWORD_ENV_VARIABLE@your-git-service.com/your-repo.git" On GitLab :https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html 在 BitBucket 上:https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/ (2认同)