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

Posted

技术标签:

【中文标题】Flutter ios 构建失败 - Distill 因未知原因而失败【英文标题】:Flutter ios build failed - Distill failed for unknown reasons 【发布时间】:2020-03-21 03:31:12 【问题描述】:

我在使用 Flutter 为 ios 构建应用程序时遇到了麻烦。我正在使用以下版本:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15 19A487m, locale en-GB)
[✓] android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.5)

当我运行“flutter build ios --release”命令时,我收到以下错误:

Error output from Xcode build:
↳
    2019-11-25 20:54 xcodebuild[15605] (FSEvents.framework) fsevent_realpath: err(2): [No such file or directory]

    ** BUILD FAILED **


Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
    Building AOT snapshot in release mode (ios-release)...          
    Building App.framework for arm64...

    Building App.framework for armv7...
    Building AOT snapshot in release mode (ios-release)...             55.4s
    Built to build/aot/.
    warning: parsing line table prologue at offset 0x6f697463 found unsupported version 0x00
    warning: line table parameters mismatch. Cannot emit.
    note: while processing /Users/mcbcsuser1/MBA_Project/mba-app/build/aot/armv7/snapshot_assembly.o
    Project /Users/mcbcsuser1/MBA_Project/mba-app built and packaged successfully.
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
    /Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/AppDelegate.m:18:128: warning: incompatible pointer types sending 'FlutterViewController *' to parameter of type
    'NSObject<FlutterBinaryMessenger> * _Nonnull' [-Wincompatible-pointer-types]
        FlutterMethodChannel* pdfChannel = [FlutterMethodChannel methodChannelWithName:@"com.mcbcs.mba2/pdfViewer" binaryMessenger:controller];
                                                                                                                                   ^~~~~~~~~~
    In module 'Flutter' imported from /Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/AppDelegate.h:1:
    /Users/mcbcsuser1/MBA_Project/mba-app/ios/Pods/../.symlinks/flutter/ios-release/Flutter.framework/Headers/FlutterChannels.h:170:74: note: passing argument to parameter 'messenger' here
                          binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
                                                                             ^
    1 warning generated.
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
    /Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/AppDelegate.m:18:128: warning: incompatible pointer types sending 'FlutterViewController *' to parameter of type
    'NSObject<FlutterBinaryMessenger> * _Nonnull' [-Wincompatible-pointer-types]
        FlutterMethodChannel* pdfChannel = [FlutterMethodChannel methodChannelWithName:@"com.mcbcs.mba2/pdfViewer" binaryMessenger:controller];
                                                                                                                                   ^~~~~~~~~~
    In module 'Flutter' imported from /Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/AppDelegate.h:1:
    /Users/mcbcsuser1/MBA_Project/mba-app/ios/Pods/../.symlinks/flutter/ios-release/Flutter.framework/Headers/FlutterChannels.h:170:74: note: passing argument to parameter 'messenger' here
                          binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
                                                                             ^
    1 warning generated.
    2019-11-25 20:55:36.012 ibtoold[15836:7610864] DEBUG: Added to environment: 
        TMPDIR = "/var/folders/kp/d0jg6_p910n84sgpg0p1v8b80000gp/T/28CC6A1B-B030-45EB-8711-C99450F6AE60";
    
    2019-11-25 20:55:37.037 IBCocoaTouchImageCatalogTool[15842:7611096] Unable to get image dimensions for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.056 IBCocoaTouchImageCatalogTool[15842:7611096] Unable to get image dimensions for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.056 IBCocoaTouchImageCatalogTool[15842:7611096] Unable to get image dimensions for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.063 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.064 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.064 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.064 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.064 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.064 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.064 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.065 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.065 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.069 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.069 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.069 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.069 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.069 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.069 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.069 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.070 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.070 IBCocoaTouchImageCatalogTool[15842:7611096] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611131] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611133] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611117] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611132] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611128] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611133] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611128] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611117] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    2019-11-25 20:55:37.086 IBCocoaTouchImageCatalogTool[15842:7611131] CoreThemeDefinition: Unable to create image for
    file:///Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
    /* com.apple.actool.errors */
    /Users/mcbcsuser1/MBA_Project/mba-app/ios/Runner/Assets.xcassets: error: Distill failed for unknown reasons.
    /* com.apple.actool.compilation-results */
    /Users/mcbcsuser1/MBA_Project/mba-app/build/ios/Release-iphoneos/Runner.app/Assets.car
    /Users/mcbcsuser1/Library/Developer/Xcode/DerivedData/Runner-apeytfmeqlxqxbbjvyssseotadoa/Build/Intermediates.noindex/Runner.build/Release-iphoneos/Runner.build/assetcatalog_generated_info.plis
    t

我已经在使用最新版本的 xcode、macos 和 Flutter。我仍然无法构建用于发布的 ios 应用程序。任何人都可以帮忙吗?谢谢。

【问题讨论】:

你能把这个排序吗?我也面临同样的问题 @David 检查我的答案 【参考方案1】:

改变这一行,

FlutterMethodChannel* pdfChannel = [FlutterMethodChannel methodChannelWithName:@"com.mcbcs.mba2/pdfViewer" binaryMessenger:controller];

FlutterMethodChannel* pdfChannel = [FlutterMethodChannel methodChannelWithName:@"com.mcbcs.mba2/pdfViewer" binaryMessenger:controller.binaryMessenger];

控制器 => 控制器.binaryMessenger

它对我有用。 并查看有关运行本机代码的官方文档 https://flutter.dev/docs/development/platform-integration/platform-channels?tab=ios-channel-objective-c-tab

【讨论】:

这条线在哪里? @easazade 此行位于 Flutter 项目中 Runner iOS 项目的 AppDelegate.swift 文件中。

以上是关于Flutter ios 构建失败 - Distill 因未知原因而失败的主要内容,如果未能解决你的问题,请参考以下文章

Flutter - iOS 构建失败

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

为啥 Flutter iOS 构建失败?

当我运行 flutter run 时,Flutter iOS 构建失败

iOS 的 Flutter 构建失败

由于线程构建失败,Flutter 在 iOS 上崩溃