添加Web支持后,iOS上的flutter构建错误

发布于 2025-01-24 20:52:45 字数 24075 浏览 6 评论 0原文


I created a flutter web app. This app is working well but I want to export it as an iOS app to use it on my phone.

当我尝试构建该应用程序时,我会遇到此错误:

Launching lib/main.dart on iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: QJAXXXXXXX
Xcode build done.                                           56,0s
Failed to build iOS app
Error output from Xcode build:
↳
    2022-04-27 16:41:52.572 xcodebuild[91214:1008948]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
    Details:  (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
    Object:   <DTDKMobileDeviceToken: 0x7f8b64b380a0>
    Method:   -platform
    Thread:   <NSThread: 0x7f8b60b20e60>{number = 2, name = (null)}
    Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    2022-04-27 16:41:52.771 xcodebuild[91214:1008959]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
    Details:  (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
    Object:   <DTDKMobileDeviceToken: 0x7f8b64b380a0>
    Method:   -platform
    Thread:   <NSThread: 0x7f8b6427c7f0>{number = 10, name = (null)}
    Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    2022-04-27 16:41:52.845 xcodebuild[91214:1008959]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
    Details:  (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
    Object:   <DTDKMobileDeviceToken: 0x7f8b64b380a0>
    Method:   -platform
    Thread:   <NSThread: 0x7f8b6427c7f0>{number = 10, name = (null)}
    Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    ** BUILD FAILED **
Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/2z/tz90cc4d63gd7v38j8zm21g80000gn/T/flutter_tools.iZwJm9/flutter_ios_build_temp_dirfoYRV2/temporary_xcresult_bundle
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Not found: 'dart:js'
    export 'dart:js' show allowInterop, allowInteropCaptureThis;
    ^
: Error: Not found: 'dart:js_util'
    export 'dart:js_util';
    ^
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Type 'Blob' not found.
      Blob _createBlobFromBytes(Uint8List bytes, String? mimeType) {
      ^^^^
: Error: Type 'Blob' not found.
      Blob? _browserBlob;
      ^^^^
: Error: Type 'Element' not found.
      late Element _target;
           ^^^^^^^
: Error: Type 'Blob' not found.
      Future<Blob> get _blob async {
             ^^^^
: Error: Type 'Blob' not found.
      Future<Uint8List> _blobToByteBuffer(Blob blob) async {
                                          ^^^^
: Error: Type 'Element' not found.
      Element Function(String href, String suggestedName) createAnchorElement;
      ^^^^^^^
: Error: Type 'AnchorElement' not found.
    AnchorElement createAnchorElement(String href, String? suggestedName) {
    ^^^^^^^^^^^^^
: Error: Type 'Element' not found.
    void addElementToContainerAndClick(Element container, Element element) {
                                       ^^^^^^^
: Error: Type 'Element' not found.
    void addElementToContainerAndClick(Element container, Element element) {
                                                          ^^^^^^^
: Error: Type 'Element' not found.
    Element ensureInitialized(String id) {
    ^^^^^^^
: Error: 'HttpRequest' isn't a type.
      final _xhrs = <HttpRequest>{};
                     ^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop((firebase_interop.UserJsImpl? user) {
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop((e) => changeController.addError(e));
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((firebase_interop.UserJsImpl? user) {
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop(idTokenChangedController.addError),
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((update) => jsify(transactionUpdate(dartify(update))));
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final onCompleteWrap = allowInterop(
                               ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final callbackWrap = allowInterop((
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        jsObject.once(eventType, allowInterop(
                                 ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DataSnapshot'.
- 'DataSnapshot' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final actionWrap = allowInterop((d) => action(DataSnapshot.getInstance(d)));
                           ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop((payload) {
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop(controller.addError);
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop((payload) {
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop((_) => null);
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop((e) {
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop(
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final onCompletion = allowInterop(() {
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop(_changeController.addError),
            ^^^^^^^^^^^^
: Error: Method not found: 'hasProperty'.
      if (js.hasProperty(error, 'message')) {
             ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
        final message = js.getProperty(error, 'message');
                           ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
        map[key] = dartify(util.getProperty(jsObject, key));
                                ^^^^^^^^^^^
: Error: Method not found: 'newObject'.
        final jsMap = util.newObject();
                           ^^^^^^^^^
: Error: Method not found: 'setProperty'.
          util.setProperty(jsMap, key, jsify(value));
               ^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
        return allowInterop(dartObject);
               ^^^^^^^^^^^^
: Error: Method not found: 'callMethod'.
        util.callMethod(jsObject, method, args);
             ^^^^^^^^^^
: Error: Method not found: 'promiseToFuture'.
        value = await util.promiseToFuture(thenable);
                           ^^^^^^^^^^^^^^^
: Error: Method not found: 'hasProperty'.
        if (util.hasProperty(e, 'code')) {
                 ^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
        PromiseJsImpl<S>(allowInterop((
                         ^^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
        allowInterop(c.completeError);
        ^^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      String get code => util.getProperty(_source, 'code');
                              ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      String get message => util.getProperty(_source, 'message');
                                 ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      String get name => util.getProperty(_source, 'name');
                              ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      Object get serverResponse => util.getProperty(_source, 'serverResponse');
                                        ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      String get stack => util.getProperty(_source, 'stack');
                               ^^^^^^^^^^^
: Error: Method not found: 'instanceof'.
      return util.instanceof(object, type);
                  ^^^^^^^^^^
: Error: Undefined name 'window'.
      Object? start = window;
                      ^^^^^^
: Error: Method not found: 'getProperty'.
        start = util.getProperty(start, item);
                     ^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Firestore'.
- 'Firestore' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final updateFunctionWrap = allowInterop((transaction) =>
                                   ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
- 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((firestore_interop.DocumentSnapshotJsImpl snapshot) {
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
- 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop((e) => controller.addError(e));
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((firestore_interop.QuerySnapshotJsImpl snapshot) {
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop((e) => controller.addError(e));
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'QuerySnapshot'.
- 'QuerySnapshot' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((s) => callback(DocumentSnapshot.getInstance(s)));
            ^^^^^^^^^^^^
: Error: The getter 'Url' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'Url'.
          _path = Url.createObjectUrl(_browserBlob);
                  ^^^
: Error: The method 'Blob' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
            ? Blob(<dynamic>[bytes])
              ^^^^
: Error: The method 'Blob' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
            : Blob(<dynamic>[bytes], mimeType);
              ^^^^
: Error: 'Blob' isn't a type.
      Blob? _browserBlob;
      ^^^^
: Error: 'Element' isn't a type.
      late Element _target;
           ^^^^^^^
: Error: 'HttpRequest' isn't a type.
        late HttpRequest request;
             ^^^^^^^^^^^
: Error: 'ProgressEvent' isn't a type.
        } on ProgressEvent catch (e) {
             ^^^^^^^^^^^^^
: Error: The getter 'HttpRequest' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'HttpRequest'.
          request = await HttpRequest.request(path, responseType: 'blob');
                          ^^^^^^^^^^^
: Error: 'Blob' isn't a type.
        final Blob blob = await _blob;
              ^^^^
: Error: 'Blob' isn't a type.
        final Blob slice = blob.slice(start ?? 0, end ?? blob.size, blob.type);
              ^^^^
: Error: 'Blob' isn't a type.
      Future<Uint8List> _blobToByteBuffer(Blob blob) async {
                                          ^^^^
: Error: 'FileReader' isn't a type.
        final FileReader reader = FileReader();
              ^^^^^^^^^^
: Error: The method 'FileReader' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'FileReader'.
        final FileReader reader = FileReader();
                                  ^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
        final AnchorElement element = _hasTestOverrides
              ^^^^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
            ? _overrides!.createAnchorElement(this.path, name) as AnchorElement
                                                                  ^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
      Element Function(String href, String suggestedName) createAnchorElement;
      ^^^^^^^
: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
        return ui.webOnlyInstantiateImageCodecFromUrl(// ignore: undefined_function, avoid_dynamic_calls
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: Error: The method 'HttpRequest' isn't defined for the class 'BrowserClient'.
- 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'.
        var xhr = HttpRequest();
                  ^^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
      final AnchorElement element = AnchorElement(href: href);
            ^^^^^^^^^^^^^
: Error: Method not found: 'AnchorElement'.
      final AnchorElement element = AnchorElement(href: href);
                                    ^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
    void addElementToContainerAndClick(Element container, Element element) {
                                       ^^^^^^^
: Error: 'Element' isn't a type.
    void addElementToContainerAndClick(Element container, Element element) {
                                                          ^^^^^^^
: Error: 'Element' isn't a type.
      Element? target = querySelector('#$id');
      ^^^^^^^
: Error: Method not found: 'querySelector'.
      Element? target = querySelector('#$id');
                        ^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
        final Element targetElement = Element.tag('flt-x-file')..id = id;
              ^^^^^^^
: Error: Undefined name 'Element'.
        final Element targetElement = Element.tag('flt-x-file')..id = id;
                                      ^^^^^^^
: Error: Method not found: 'querySelector'.
        querySelector('body')!.children.add(targetElement);
        ^^^^^^^^^^^^^
: Error: Undefined name 'window'.
      return window.navigator.vendor == 'Apple Computer, Inc.';
             ^^^^^^
    Unhandled exception:
    FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1      asFileUri (package:vm/kernel_front_end.dart:623:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:763:21)
    <asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:586:9)
    <asynchronous suspension>
#4      starter (package:flutter_frontend_server/server.dart:85:12)
    <asynchronous suspension>
#5      main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24)
    <asynchronous suspension>
    Failed to package /Users/Pierre/AndroidStudioProjects/picomanager.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel
    /Users/Pierre/AndroidStudioProjects/picomanager/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'leveldb-library' from project 'Pods')
    Result bundle written to path:
        /var/folders/2z/tz90cc4d63gd7v38j8zm21g80000gn/T/flutter_tools.iZwJm9/flutter_ios_build_temp_dirfoYRV2/temporary_xcresult_bundle
Could not build the precompiled application for the device.

Error launching application on iPhone.
Exited (sigterm)

您以前曾经看过此错误吗? 您是如何修复的?我试图多次清洁该项目,但这无法正常工作。 是否可以在iOS上构建为Web设计的Flutter应用程序?

谢谢 !

I created a flutter web app.
This app is working well but I want to export it as an iOS app to use it on my phone.

When I try to build the app, I get this error :

Launching lib/main.dart on iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: QJAXXXXXXX
Xcode build done.                                           56,0s
Failed to build iOS app
Error output from Xcode build:
↳
    2022-04-27 16:41:52.572 xcodebuild[91214:1008948]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
    Details:  (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
    Object:   <DTDKMobileDeviceToken: 0x7f8b64b380a0>
    Method:   -platform
    Thread:   <NSThread: 0x7f8b60b20e60>{number = 2, name = (null)}
    Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    2022-04-27 16:41:52.771 xcodebuild[91214:1008959]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
    Details:  (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
    Object:   <DTDKMobileDeviceToken: 0x7f8b64b380a0>
    Method:   -platform
    Thread:   <NSThread: 0x7f8b6427c7f0>{number = 10, name = (null)}
    Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    2022-04-27 16:41:52.845 xcodebuild[91214:1008959]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19114/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
    Details:  (null) deviceType from 00008030-001E2CC81E9A402E was NULL when -platform called.
    Object:   <DTDKMobileDeviceToken: 0x7f8b64b380a0>
    Method:   -platform
    Thread:   <NSThread: 0x7f8b6427c7f0>{number = 10, name = (null)}
    Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    ** BUILD FAILED **
Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/2z/tz90cc4d63gd7v38j8zm21g80000gn/T/flutter_tools.iZwJm9/flutter_ios_build_temp_dirfoYRV2/temporary_xcresult_bundle
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
Invalid depfile: /Users/Pierre/AndroidStudioProjects/picomanager/.dart_tool/flutter_build/05d710429877ee87af274badd140677f/kernel_snapshot.d
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Not found: 'dart:js'
    export 'dart:js' show allowInterop, allowInteropCaptureThis;
    ^
: Error: Not found: 'dart:js_util'
    export 'dart:js_util';
    ^
: Error: Not found: 'dart:html'
    import 'dart:html';
           ^
: Error: Type 'Blob' not found.
      Blob _createBlobFromBytes(Uint8List bytes, String? mimeType) {
      ^^^^
: Error: Type 'Blob' not found.
      Blob? _browserBlob;
      ^^^^
: Error: Type 'Element' not found.
      late Element _target;
           ^^^^^^^
: Error: Type 'Blob' not found.
      Future<Blob> get _blob async {
             ^^^^
: Error: Type 'Blob' not found.
      Future<Uint8List> _blobToByteBuffer(Blob blob) async {
                                          ^^^^
: Error: Type 'Element' not found.
      Element Function(String href, String suggestedName) createAnchorElement;
      ^^^^^^^
: Error: Type 'AnchorElement' not found.
    AnchorElement createAnchorElement(String href, String? suggestedName) {
    ^^^^^^^^^^^^^
: Error: Type 'Element' not found.
    void addElementToContainerAndClick(Element container, Element element) {
                                       ^^^^^^^
: Error: Type 'Element' not found.
    void addElementToContainerAndClick(Element container, Element element) {
                                                          ^^^^^^^
: Error: Type 'Element' not found.
    Element ensureInitialized(String id) {
    ^^^^^^^
: Error: 'HttpRequest' isn't a type.
      final _xhrs = <HttpRequest>{};
                     ^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop((firebase_interop.UserJsImpl? user) {
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop((e) => changeController.addError(e));
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((firebase_interop.UserJsImpl? user) {
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop(idTokenChangedController.addError),
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((update) => jsify(transactionUpdate(dartify(update))));
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final onCompleteWrap = allowInterop(
                               ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final callbackWrap = allowInterop((
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        jsObject.once(eventType, allowInterop(
                                 ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DataSnapshot'.
- 'DataSnapshot' is from 'package:firebase/src/database.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final actionWrap = allowInterop((d) => action(DataSnapshot.getInstance(d)));
                           ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop((payload) {
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop(controller.addError);
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop((payload) {
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop((_) => null);
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
- 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/messaging.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop((e) {
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final nextWrapper = allowInterop(
                            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final onCompletion = allowInterop(() {
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop(_changeController.addError),
            ^^^^^^^^^^^^
: Error: Method not found: 'hasProperty'.
      if (js.hasProperty(error, 'message')) {
             ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
        final message = js.getProperty(error, 'message');
                           ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
        map[key] = dartify(util.getProperty(jsObject, key));
                                ^^^^^^^^^^^
: Error: Method not found: 'newObject'.
        final jsMap = util.newObject();
                           ^^^^^^^^^
: Error: Method not found: 'setProperty'.
          util.setProperty(jsMap, key, jsify(value));
               ^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
        return allowInterop(dartObject);
               ^^^^^^^^^^^^
: Error: Method not found: 'callMethod'.
        util.callMethod(jsObject, method, args);
             ^^^^^^^^^^
: Error: Method not found: 'promiseToFuture'.
        value = await util.promiseToFuture(thenable);
                           ^^^^^^^^^^^^^^^
: Error: Method not found: 'hasProperty'.
        if (util.hasProperty(e, 'code')) {
                 ^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
        PromiseJsImpl<S>(allowInterop((
                         ^^^^^^^^^^^^
: Error: Method not found: 'allowInterop'.
        allowInterop(c.completeError);
        ^^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      String get code => util.getProperty(_source, 'code');
                              ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      String get message => util.getProperty(_source, 'message');
                                 ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      String get name => util.getProperty(_source, 'name');
                              ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      Object get serverResponse => util.getProperty(_source, 'serverResponse');
                                        ^^^^^^^^^^^
: Error: Method not found: 'getProperty'.
      String get stack => util.getProperty(_source, 'stack');
                               ^^^^^^^^^^^
: Error: Method not found: 'instanceof'.
      return util.instanceof(object, type);
                  ^^^^^^^^^^
: Error: Undefined name 'window'.
      Object? start = window;
                      ^^^^^^
: Error: Method not found: 'getProperty'.
        start = util.getProperty(start, item);
                     ^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Firestore'.
- 'Firestore' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final updateFunctionWrap = allowInterop((transaction) =>
                                   ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
- 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((firestore_interop.DocumentSnapshotJsImpl snapshot) {
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
- 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop((e) => controller.addError(e));
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((firestore_interop.QuerySnapshotJsImpl snapshot) {
            ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        final errorWrapper = allowInterop((e) => controller.addError(e));
                             ^^^^^^^^^^^^
: Error: The method 'allowInterop' isn't defined for the class 'QuerySnapshot'.
- 'QuerySnapshot' is from 'package:firebase/src/firestore.dart' ('../../.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
            allowInterop((s) => callback(DocumentSnapshot.getInstance(s)));
            ^^^^^^^^^^^^
: Error: The getter 'Url' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'Url'.
          _path = Url.createObjectUrl(_browserBlob);
                  ^^^
: Error: The method 'Blob' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
            ? Blob(<dynamic>[bytes])
              ^^^^
: Error: The method 'Blob' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
            : Blob(<dynamic>[bytes], mimeType);
              ^^^^
: Error: 'Blob' isn't a type.
      Blob? _browserBlob;
      ^^^^
: Error: 'Element' isn't a type.
      late Element _target;
           ^^^^^^^
: Error: 'HttpRequest' isn't a type.
        late HttpRequest request;
             ^^^^^^^^^^^
: Error: 'ProgressEvent' isn't a type.
        } on ProgressEvent catch (e) {
             ^^^^^^^^^^^^^
: Error: The getter 'HttpRequest' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'HttpRequest'.
          request = await HttpRequest.request(path, responseType: 'blob');
                          ^^^^^^^^^^^
: Error: 'Blob' isn't a type.
        final Blob blob = await _blob;
              ^^^^
: Error: 'Blob' isn't a type.
        final Blob slice = blob.slice(start ?? 0, end ?? blob.size, blob.type);
              ^^^^
: Error: 'Blob' isn't a type.
      Future<Uint8List> _blobToByteBuffer(Blob blob) async {
                                          ^^^^
: Error: 'FileReader' isn't a type.
        final FileReader reader = FileReader();
              ^^^^^^^^^^
: Error: The method 'FileReader' isn't defined for the class 'XFile'.
- 'XFile' is from 'package:cross_file/src/types/html.dart' ('../../.pub-cache/hosted/pub.dartlang.org/cross_file-0.3.2/lib/src/types/html.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'FileReader'.
        final FileReader reader = FileReader();
                                  ^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
        final AnchorElement element = _hasTestOverrides
              ^^^^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
            ? _overrides!.createAnchorElement(this.path, name) as AnchorElement
                                                                  ^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
      Element Function(String href, String suggestedName) createAnchorElement;
      ^^^^^^^
: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
        return ui.webOnlyInstantiateImageCodecFromUrl(// ignore: undefined_function, avoid_dynamic_calls
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: Error: The method 'HttpRequest' isn't defined for the class 'BrowserClient'.
- 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'.
        var xhr = HttpRequest();
                  ^^^^^^^^^^^
: Error: 'AnchorElement' isn't a type.
      final AnchorElement element = AnchorElement(href: href);
            ^^^^^^^^^^^^^
: Error: Method not found: 'AnchorElement'.
      final AnchorElement element = AnchorElement(href: href);
                                    ^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
    void addElementToContainerAndClick(Element container, Element element) {
                                       ^^^^^^^
: Error: 'Element' isn't a type.
    void addElementToContainerAndClick(Element container, Element element) {
                                                          ^^^^^^^
: Error: 'Element' isn't a type.
      Element? target = querySelector('#$id');
      ^^^^^^^
: Error: Method not found: 'querySelector'.
      Element? target = querySelector('#$id');
                        ^^^^^^^^^^^^^
: Error: 'Element' isn't a type.
        final Element targetElement = Element.tag('flt-x-file')..id = id;
              ^^^^^^^
: Error: Undefined name 'Element'.
        final Element targetElement = Element.tag('flt-x-file')..id = id;
                                      ^^^^^^^
: Error: Method not found: 'querySelector'.
        querySelector('body')!.children.add(targetElement);
        ^^^^^^^^^^^^^
: Error: Undefined name 'window'.
      return window.navigator.vendor == 'Apple Computer, Inc.';
             ^^^^^^
    Unhandled exception:
    FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1      asFileUri (package:vm/kernel_front_end.dart:623:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:763:21)
    <asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:586:9)
    <asynchronous suspension>
#4      starter (package:flutter_frontend_server/server.dart:85:12)
    <asynchronous suspension>
#5      main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24)
    <asynchronous suspension>
    Failed to package /Users/Pierre/AndroidStudioProjects/picomanager.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel
    /Users/Pierre/AndroidStudioProjects/picomanager/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'leveldb-library' from project 'Pods')
    Result bundle written to path:
        /var/folders/2z/tz90cc4d63gd7v38j8zm21g80000gn/T/flutter_tools.iZwJm9/flutter_ios_build_temp_dirfoYRV2/temporary_xcresult_bundle
Could not build the precompiled application for the device.

Error launching application on iPhone.
Exited (sigterm)

Have you ever seen this error before ?
How did you fix it ? I tried to clean the project several times but this is not working.
Is it possible to build a flutter app designed for web on iOS ?

Thank you !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请叫√我孤独 2025-01-31 20:52:45

不幸的是,如果您在代码中某个地方的某个地方有dart的导入:html flutter构建会破裂。

解决此问题的解决方案可能是使用条件导入,但是您必须构造类似的东西:

downlationer.dart

void downloadFile(List<int> data, String fileName) {
  throw UnimplementedError('Cannot use the downloader');
}

downloader_mobile.dart

import 'dart:developer';

void downloadFile(List<int> data, String fileName) {
  log('Download is not available for mobile.');
}

downloader_web.dart

// ignore_for_file: avoid_web_libraries_in_flutter

import 'dart:convert';
import 'dart:html' as html;

void downloadFile(List<int> data, String fileName) {
  final base64encodedData = base64Encode(data);
  final anchor = html.AnchorElement(
    href: 'data:application/octet-stream;charset=utf-8;'
        'base64,$base64encodedData',
  )
    ..setAttribute('download', fileName)
    ..click();

  html.document.body?.children.remove(anchor);
}

,在消费类中,我们检查是否存在dart.library.io.io < /code>和dart.library.js确定我们是否在网络或移动环境中。

import 'package:xxx/features/xxx/tools/downloader.dart'
    if (dart.library.io) 'package:xxx/features/xxx/tools/downloader_mobile.dart'
    if (dart.library.js) 'package:xxx/features/xxx/tools/downloader_web.dart';

Unfortunately, Flutter builds for mobile platforms break if you have an import of dart:html somewhere in your code.

A solution to this problem can be to use conditional imports, but you have to construct something like this:

downloader.dart

void downloadFile(List<int> data, String fileName) {
  throw UnimplementedError('Cannot use the downloader');
}

downloader_mobile.dart

import 'dart:developer';

void downloadFile(List<int> data, String fileName) {
  log('Download is not available for mobile.');
}

downloader_web.dart

// ignore_for_file: avoid_web_libraries_in_flutter

import 'dart:convert';
import 'dart:html' as html;

void downloadFile(List<int> data, String fileName) {
  final base64encodedData = base64Encode(data);
  final anchor = html.AnchorElement(
    href: 'data:application/octet-stream;charset=utf-8;'
        'base64,$base64encodedData',
  )
    ..setAttribute('download', fileName)
    ..click();

  html.document.body?.children.remove(anchor);
}

And in the consuming class we check for the existence of dart.library.io and dart.library.js to determine if we are in a web or mobile environment.

import 'package:xxx/features/xxx/tools/downloader.dart'
    if (dart.library.io) 'package:xxx/features/xxx/tools/downloader_mobile.dart'
    if (dart.library.js) 'package:xxx/features/xxx/tools/downloader_web.dart';
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文