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 :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 :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

你可能感兴趣的:(flutter stable 1.22.5 iOS 打包失败)