flutter stable 1.22.5 iOS 打包失敗

  • 錯誤一
Running Xcode build...                                                  
                                                   
Xcode build done.                                           134.7s
Failed to build iOS app
Error output from Xcode build:
?
    2020-12-30 18:23:05.470 XCBBuildService[7123:39015] Failed to remove:
    /Users/mac/Library/Developer/Xcode/DerivedData/Runner-amrqppeggnupprgxdkmoqmzdyhrj/Build/Intermediates.noindex/XCBuil
    dData/b1aa1434cf3d3114cf4ac13bd86246ee-manifest.xcbuild:
    unlink(/Users/mac/Library/Developer/Xcode/DerivedData/Runner-amrqppeggnupprgxdkmoqmzdyhrj/Build/Intermediates.noindex
    /XCBuildData/b1aa1434cf3d3114cf4ac13bd86246ee-manifest.xcbuild): No such file or directory (2)
    2020-12-30 18:23:05.685 XCBBuildService[7123:39015] Failed to remove:
    /Users/mac/Library/Developer/Xcode/DerivedData/Runner-amrqppeggnupprgxdkmoqmzdyhrj/Build/Intermediates.noindex/XCBuil
    dData/b1aa1434cf3d3114cf4ac13bd86246ee-desc.xcbuild:
    unlink(/Users/mac/Library/Developer/Xcode/DerivedData/Runner-amrqppeggnupprgxdkmoqmzdyhrj/Build/Intermediates.noindex
    /XCBuildData/b1aa1434cf3d3114cf4ac13bd86246ee-desc.xcbuild): No such file or directory (2)
    ** BUILD FAILED **


Xcode's output:
?
    While building module 'Bugly' imported from
    /Users/mac/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/bugly_flutter-1.0.0/ios/Classes/BuglyFlutterPlugi
    n.m:2:
    In file included from <module-includes>:1:
    In file included from /Users/mac/Works/ehs-master/ios/Pods/Bugly/Bugly.framework/Headers/Bugly.h:11:
    /Users/mac/Works/ehs-master/ios/Pods/Bugly/Bugly.framework/Headers/BuglyConfig.h:46:21: warning: empty paragraph
    passed to '@param' command [-Wdocumentation]
     *  @param tacticInfo
        ~~~~~~~~~~~~~~~~^
    1 warning generated.
    1 warning generated.
    While building module 'Bugly' imported from
    /Users/mac/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/bugly_flutter-1.0.0/ios/Classes/BuglyFlutterPlugi
    n.m:2:
    In file included from <module-includes>:1:
    In file included from /Users/mac/Works/ehs-master/ios/Pods/Bugly/Bugly.framework/Headers/Bugly.h:11:
    /Users/mac/Works/ehs-master/ios/Pods/Bugly/Bugly.framework/Headers/BuglyConfig.h:46:21: warning: empty paragraph
    passed to '@param' command [-Wdocumentation]
     *  @param tacticInfo
        ~~~~~~~~~~~~~~~~^
    1 warning generated.
    1 warning generated.
    /Users/mac/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/barcode_scan-2.0.2/ios/Classes/BarcodeScannerView
    Controller.m:10:17: warning: method definition for 'initWithOptions:' not found [-Wincomplete-implementation]
    @implementation BarcodeScannerViewController {
                    ^
    In file included from
    /Users/mac/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/barcode_scan-2.0.2/ios/Classes/BarcodeScannerView
    Controller.m:5:
    /Users/mac/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/barcode_scan-2.0.2/ios/Classes/BarcodeScannerView
    Controller.h:19:3: note: method 'initWithOptions:' declared here
      -(id) initWithOptions:(NSDictionary *) options;
      ^
    1 warning generated.
    /Users/mac/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/barcode_scan-2.0.2/ios/Classes/BarcodeScannerView
    Controller.m:10:17: warning: method definition for 'initWithOptions:' not found [-Wincomplete-implementation]
    @implementation BarcodeScannerViewController {
                    ^
    In file included from
    /Users/mac/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/barcode_scan-2.0.2/ios/Classes/BarcodeScannerView
    Controller.m:5:
    /Users/mac/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/barcode_scan-2.0.2/ios/Classes/BarcodeScannerView
    Controller.h:19:3: note: method 'initWithOptions:' declared here
      -(id) initWithOptions:(NSDictionary *) options;
      ^
    1 warning generated.
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLThumbnailViewController.m:290:122:
    warning: values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long'
    instead [-Wformat]
            [self.btnDone setTitle:[NSString stringWithFormat:@"%@(%ld)",
            GetLocalLanguageTextValue(ZLPhotoBrowserDoneText), nav.arrSelectedModels.count]
            forState:UIControlStateNormal];
                                                                   ~~~
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                   %lu
                                                                   (unsigned long)
    1 warning generated.
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLShowBigImgViewController.m:239:63:
    warning: values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
    [-Wformat]
        _titleLabel.text = [NSString stringWithFormat:@"%ld/%ld", _currentPage, self.models.count];
                                                        ~~~       ^~~~~~~~~~~~
                                                        %ld       (long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLShowBigImgViewController.m:239:77:
    warning: values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long'
    instead [-Wformat]
        _titleLabel.text = [NSString stringWithFormat:@"%ld/%ld", _currentPage, self.models.count];
                                                            ~~~                 ^~~~~~~~~~~~~~~~~
                                                            %lu                 (unsigned long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLShowBigImgViewController.m:612:118:
    warning: values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long'
    instead [-Wformat]
            [_btnDone setTitle:[NSString stringWithFormat:@"%@(%ld)", GetLocalLanguageTextValue(ZLPhotoBrowserDoneText),
            nav.arrSelectedModels.count] forState:UIControlStateNormal];
                                                               ~~~
                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                               %lu
                                                               (unsigned long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLShowBigImgViewController.m:782:67:
    warning: values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
    [-Wformat]
            _titleLabel.text = [NSString stringWithFormat:@"%ld/%ld", _currentPage, self.models.count];
                                                            ~~~       ^~~~~~~~~~~~
                                                            %ld       (long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLShowBigImgViewController.m:782:81:
    warning: values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long'
    instead [-Wformat]
            _titleLabel.text = [NSString stringWithFormat:@"%ld/%ld", _currentPage, self.models.count];
                                                                ~~~                 ^~~~~~~~~~~~~~~~~
                                                                %lu                 (unsigned long)
    5 warnings generated.
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLPhotoManager.m:350:56: warning:
    values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
            return [NSString stringWithFormat:@"00:%02ld", duration];
                                                   ~~~~~   ^~~~~~~~
                                                   %02ld   (long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLPhotoManager.m:354:59: warning:
    values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
            return [NSString stringWithFormat:@"%02ld:%02ld", m, s];
                                                ~~~~~         ^
                                                %02ld         (long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLPhotoManager.m:354:62: warning:
    values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
            return [NSString stringWithFormat:@"%02ld:%02ld", m, s];
                                                      ~~~~~      ^
                                                      %02ld      (long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLPhotoManager.m:359:65: warning:
    values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
            return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", h, m, s];
                                                ~~~~~               ^
                                                %02ld               (long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLPhotoManager.m:359:68: warning:
    values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
            return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", h, m, s];
                                                      ~~~~~            ^
                                                      %02ld            (long)
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLPhotoManager.m:359:71: warning:
    values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
            return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", h, m, s];
                                                            ~~~~~         ^
                                                            %02ld         (long)
    6 warnings generated.
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLPhotoBrowserCell.m:48:63: warning:
    values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
        self.labCount.text = [NSString stringWithFormat:@"(%ld)", model.count];
                                                           ~~~    ^~~~~~~~~~~
                                                           %ld    (long)
    1 warning generated.
    /Users/mac/Works/ehs-master/ios/Pods/ZLPhotoBrowser/ZLPhotoBrowser/PhotoBrowser/ZLPhotoActionSheet.m:590:124:
    warning: values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long'
    instead [-Wformat]
            [self.btnCancel setTitle:[NSString stringWithFormat:@"%@(%ld)",
            GetLocalLanguageTextValue(ZLPhotoBrowserDoneText), self.arrSelectedModels.count]
            forState:UIControlStateNormal];
                                                                     ~~~
                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                     %lu
                                                                     (unsigned long)

打開Xcode File-> Workspace Setting 選擇 Legacy Build System

image.png
  • 錯誤二
This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations:
      - file:///Users/mac/Works/ehs-master/lib/common/font_utils.dart:79:17
      - file:///Users/mac/Works/ehs-master/lib/common/font_utils.dart:84:17
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:11:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:17:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:24:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:30:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:36:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:42:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:48:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:54:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:60:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:66:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:72:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:78:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:84:16
      - file:///Users/mac/Works/ehs-master/lib/sourcebean/transactionCenter.dart:90:16

解決方法
1: 打包時加上 --no-tree-shake-icons
flutter build ios --release --no-tree-shake-icons
2:在IconData之前加上const

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 邂逅FLutter 萬物皆是Widget 一般縮進(jìn)2個空格 文字居中 Widget Center() Materi...
    JackLeeVip閱讀 3,491評論 0 4
  • flutter打包報錯記錄: Unexpected duplicate tasks處理方法:修改項目編譯,不使用N...
    lym不解釋閱讀 6,270評論 0 2
  • General New Features Xcode 11 beta supports development w...
    Zszen閱讀 3,580評論 0 50
  • 不積跬步無以至千里。再愚蠢的Bug,也是進(jìn)步的墊腳石。 Mac 軟件安裝提示“文件損壞,打不開” i386, x8...
    DylanPP閱讀 1,991評論 0 0
  • 久違的晴天,家長會。 家長大會開好到教室時,離放學(xué)已經(jīng)沒多少時間了。班主任說已經(jīng)安排了三個家長分享經(jīng)驗。 放學(xué)鈴聲...
    飄雪兒5閱讀 7,794評論 16 22

友情鏈接更多精彩內(nèi)容