魔码 | iOS 构建失败

Posted

技术标签:

【中文标题】魔码 | iOS 构建失败【英文标题】:Codemagic | iOS Build failed 【发布时间】:2021-12-14 22:08:48 【问题描述】:

我正在尝试使用 Codemagic 构建我的应用程序,但没有成功。 这是日志。但是,我不明白我应该怎么做才能修复它。如果有人可以帮助我,我将不胜感激。

我目前正在尝试从 codemagic 构建它,因为我没有 mac。如果您知道其他可以解决问题的方法,请随时告诉我。

== Building for ios ==

> flutter build ios --release --no-codesign
Running "flutter pub get" in clone...                            1,235ms
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.example.flutterApplication1 for device (ios-release)...
Running pod install...                                           2,411ms
Running Xcode build...                                          
Xcode build done.                                           112.8s
Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
     platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device 
     platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device 
     platform:iOS Simulator, id:BDBAD2FC-16AD-45F2-8BA2-1B6A744CAFB6, OS:14.5, name:iPad (8th generation) 
     platform:iOS Simulator, id:03A783D6-D52A-4FFF-B04F-6A692F09A948, OS:15.0, name:iPad (9th generation) 
     platform:iOS Simulator, id:AF693EA2-3CEE-406E-9FD3-2AEF7C7AE4E0, OS:14.5, name:iPad Air (4th generation) 
     platform:iOS Simulator, id:F98892BC-3737-4027-AFD2-BBDF1C17ECBF, OS:15.0, name:iPad Air (4th generation) 
     platform:iOS Simulator, id:A9EBBABF-6741-4F1E-9139-E5713AF89F7E, OS:14.5, name:iPad Pro (9.7-inch) 
     platform:iOS Simulator, id:E8CE8886-0B2C-43FF-8EEE-603A8A1685C8, OS:15.0, name:iPad Pro (9.7-inch) 
     platform:iOS Simulator, id:CE50B412-8301-4439-86D9-218E9B520C64, OS:14.5, name:iPad Pro (11-inch) (2nd generation) 
     platform:iOS Simulator, id:503ED4B8-9480-401C-99CC-F37B5E9DEDEE, OS:14.5, name:iPad Pro (11-inch) (3rd generation) 
     platform:iOS Simulator, id:9FD9A6C7-96D1-427D-BBCA-DDE9DFA903BA, OS:15.0, name:iPad Pro (11-inch) (3rd generation) 
     platform:iOS Simulator, id:560D986F-3412-47DA-B037-69BBD7873E2B, OS:14.5, name:iPad Pro (12.9-inch) (4th generation) 
     platform:iOS Simulator, id:99B14BF4-7966-4427-ACD1-34BFE4D26A01, OS:14.5, name:iPad Pro (12.9-inch) (5th generation) 
     platform:iOS Simulator, id:EF9AE2FD-212D-4D6C-AF22-73D7491B8B7F, OS:15.0, name:iPad Pro (12.9-inch) (5th generation) 
     platform:iOS Simulator, id:9E2823A4-64EA-4D60-A7EF-B401D4EE9D47, OS:15.0, name:iPad mini (6th generation) 
     platform:iOS Simulator, id:ED635705-38B8-41E4-977A-009F1893C7C8, OS:14.5, name:iPhone 8 
     platform:iOS Simulator, id:7C5473C2-9C4E-47E5-8282-442FDF8EB347, OS:15.0, name:iPhone 8 
     platform:iOS Simulator, id:6689C1EF-3619-4DE3-AF9F-4A0BAB1FD532, OS:14.5, name:iPhone 8 Plus 
     platform:iOS Simulator, id:A634BCFD-FC7A-470C-889A-62808EDCE7B5, OS:15.0, name:iPhone 8 Plus 
     platform:iOS Simulator, id:A8F9CFAD-11FF-46A2-B957-11CB50A189EE, OS:14.5, name:iPhone 11 
     platform:iOS Simulator, id:9392FD28-3E15-4CD2-B4D1-BD5B48E6238D, OS:15.0, name:iPhone 11 
     platform:iOS Simulator, id:1F17BDC6-F7BA-4D6C-AED3-19992BE39743, OS:14.5, name:iPhone 11 Pro 
     platform:iOS Simulator, id:1228C53F-AD8F-494F-A7C3-4D53005062DF, OS:15.0, name:iPhone 11 Pro 
     platform:iOS Simulator, id:86ABCECA-0FF3-4244-925A-CEA93D003D6A, OS:14.5, name:iPhone 11 Pro Max 
     platform:iOS Simulator, id:C47A5DA4-03E4-415C-9B28-CFE17AD81A4F, OS:15.0, name:iPhone 11 Pro Max 
     platform:iOS Simulator, id:839F3C4C-B9BC-4F54-BF0F-84CE9BDF79E4, OS:14.5, name:iPhone 12 
     platform:iOS Simulator, id:243CD93E-F060-4413-936A-E1C717A78DBE, OS:15.0, name:iPhone 12 
     platform:iOS Simulator, id:4E0DDFA4-6C79-4774-9616-20514A2A8714, OS:14.5, name:iPhone 12 Pro 
     platform:iOS Simulator, id:D6C83C0B-6EF8-4866-B532-F4CF7ED69C50, OS:15.0, name:iPhone 12 Pro 
     platform:iOS Simulator, id:EE34ECEA-7277-410B-90B2-23DEC7C06077, OS:14.5, name:iPhone 12 Pro Max 
     platform:iOS Simulator, id:64FC4CC4-95DA-48FE-9980-8AB26CEE9892, OS:15.0, name:iPhone 12 Pro Max 
     platform:iOS Simulator, id:DEF97C06-7FB2-4895-9B5D-11CA40EB3213, OS:14.5, name:iPhone 12 mini 
     platform:iOS Simulator, id:E2866178-464C-4D5C-A13D-3597F07DD133, OS:15.0, name:iPhone 12 mini 
     platform:iOS Simulator, id:EF87D420-E8D1-4B12-B85C-4BBA52FBD220, OS:15.0, name:iPhone 13 
     platform:iOS Simulator, id:AC52617F-729B-4308-8CDB-FD850720B274, OS:15.0, name:iPhone 13 Pro 
     platform:iOS Simulator, id:25315873-BCF7-4159-B6E1-5BD7A2533650, OS:15.0, name:iPhone 13 Pro Max 
     platform:iOS Simulator, id:2D48F1AA-93AC-48DA-99E7-1B1D44ED5E66, OS:15.0, name:iPhone 13 mini 
     platform:iOS Simulator, id:EA386A2D-32C2-4593-B2B9-2182F366C195, OS:14.5, name:iPhone SE (2nd generation) 
     platform:iOS Simulator, id:B47CBB9A-B743-4983-AE42-D576BFB99930, OS:15.0, name:iPhone SE (2nd generation) 
     platform:iOS Simulator, id:14C619EC-2882-497C-A2A9-6130E2D2BF8C, OS:14.5, name:iPod touch (7th generation) 
     platform:iOS Simulator, id:4F9DD40E-EB0B-4C05-876A-8E1FFC9BAEF8, OS:15.0, name:iPod touch (7th generation) 
    ** BUILD FAILED **


Xcode's output:
↳
    This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations:
      - file:///Users/builder/clone/lib/screens/homescreen.dart:158:53
      - file:///Users/builder/clone/lib/screens/homescreen.dart:447:22
    Failed to package /Users/builder/clone.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel

════════════════════════════════════════════════════════════════════════════════
Building a deployable iOS app requires a selected Development Team with a 
Provisioning Profile. Please ensure that a Development Team is selected by:
  1- Open the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team. 
     You may need to:
         - Log in with your Apple ID in Xcode first
         - Ensure you have a valid unique Bundle ID
         - Register your device with your Apple Developer Account
         - Let Xcode automatically provision a profile for your app
  4- Build or run your project again

For more information, please visit:
  https://flutter.dev/docs/get-started/install/macos#deploy-to-ios-devices

Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Encountered error while building for device.


Build failed :|
Failed to build for iOS

【问题讨论】:

【参考方案1】:

您可以尝试以下解决方案:

检查您的Icon 实施如何推荐here 尝试使用 --no-tree-shake-icons 选项构建(设置 > 构建 > 构建参数 > iOS) 升级 Flutter 版本

【讨论】:

您好,谢谢您的回复。使用--no-tree-shake-icons 它可以工作。但是,我不能使用“const”,因为如果满足某些条件,图标会发生变化。可以一直使用--no-tree-shake-icons吗?

以上是关于魔码 | iOS 构建失败的主要内容,如果未能解决你的问题,请参考以下文章

Flutter iOS 构建失败:目标 kernel_snapshot 失败:异常:快照创建期间出错:null 构建失败

Flutter ios 构建失败 - Distill 因未知原因而失败

Nativescript Algolia iOS 构建失败

为啥 Flutter iOS 构建失败?

IOS 构建因链接而失败

如何在 iTunes 中删除失败的 iOS 构建?有可能吗?