Flutter 运行和 ipa - Mac M1 - #import <Flutter/Flutter.h>

Posted

技术标签:

【中文标题】Flutter 运行和 ipa - Mac M1 - #import <Flutter/Flutter.h>【英文标题】:Flutter run and ipa - Mac M1 - #import <Flutter/Flutter.h> 【发布时间】:2022-01-15 01:37:06 【问题描述】:

清理 pod 后,我无法再构建我的项目。 我想第一次构建 ipa,但由于flutter runflutter build ipa 出现此错误,所以无法实现。感谢您的帮助。

更新了跟踪日志并记录了新的错误

顺便说一下,这是在 macbook M1 芯片上。

感谢您的帮助,不胜感激。

Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...                                                  
Xcode build done.                                            3.0s
Failed to build ios app
Error output from Xcode build:
↳
    objc[82744]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib
    (0x1f7ef3130) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice
    (0x105ae42c8). One of the two will be used. Which one is undefined.
    objc[82744]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x1f7ef3180)
    and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice
    (0x105ae4318). One of the two will be used. Which one is undefined.
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
     platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder,
    name:Any iOS Simulator Device 
     platform:iOS Simulator, id:AD71F6D7-E4C2-44C2-87A9-81B59FFC7C80, OS:15.2, name:iPad (9th generation)
    
     platform:iOS Simulator, id:63640A82-DCF5-4855-A5F2-90AF00E9E6DF, OS:15.2, name:iPad Air (4th
    generation) 
     platform:iOS Simulator, id:31CA8F73-7F3A-4D56-8928-85E7097476BB, OS:15.2, name:iPad Pro (9.7-inch) 
     platform:iOS Simulator, id:253D8767-81F3-4FEC-89F0-BE228B851B85, OS:15.2, name:iPad Pro (11-inch)
    (3rd generation) 
     platform:iOS Simulator, id:5C82E6C0-9FB1-40BD-838C-00EC58C6DCC7, OS:15.2, name:iPad Pro (12.9-inch)
    (5th generation) 
     platform:iOS Simulator, id:B3406877-B55F-46F0-930E-30D7648B09B8, OS:15.2, name:iPad mini (6th
    generation) 
     platform:iOS Simulator, id:18F99A95-122F-4EBE-BC8B-06B62D1E3E8E, OS:15.2, name:iPhone 8 
     platform:iOS Simulator, id:939D08A5-C470-41B7-A241-AD4DA7FE8ABA, OS:15.2, name:iPhone 8 Plus 
     platform:iOS Simulator, id:538F2CCC-7CFD-425F-A252-F4A46FE79A30, OS:15.2, name:iPhone 11 
     platform:iOS Simulator, id:FF126BB0-7DF9-4976-8878-625031BDA3C0, OS:15.2, name:iPhone 11 Pro 
     platform:iOS Simulator, id:84A799FD-6B0B-4000-8596-69ECF4FDF1E1, OS:15.2, name:iPhone 11 Pro Max 
     platform:iOS Simulator, id:D79C2732-B5BC-4EA4-8CF1-2E4DD7ADF469, OS:15.2, name:iPhone 12 
     platform:iOS Simulator, id:30C8D07D-6489-4C3B-B26D-CD24DC5F72C3, OS:15.2, name:iPhone 12 Pro 
     platform:iOS Simulator, id:89AD22E9-5AD9-40A3-BC4A-13A73806A748, OS:15.2, name:iPhone 12 Pro Max 
     platform:iOS Simulator, id:2A2D47AF-C4C5-4098-8F43-0F178AE620BA, OS:15.2, name:iPhone 12 mini 
     platform:iOS Simulator, id:639C83E9-851D-4D27-BCE4-12524100F98A, OS:15.2, name:iPhone 13 
     platform:iOS Simulator, id:EAB79697-A076-48AF-8758-AFD83A03B286, OS:15.2, name:iPhone 13 Pro 
     platform:iOS Simulator, id:87F9D4C0-8771-49D0-B1CC-5D06FF2C2CC7, OS:15.2, name:iPhone 13 Pro Max 
     platform:iOS Simulator, id:A03B272B-0D2F-48F5-97A1-153E7A281070, OS:15.2, name:iPhone 13 mini 
     platform:iOS Simulator, id:91748DDF-6EED-41C1-85AB-FF609E333FB1, OS:15.2, name:iPhone SE (2nd
    generation) 
     platform:iOS Simulator, id:553E6A57-23AF-462B-B4D1-59B5AD6BC5BA, OS:15.2, name:iPod touch (7th
    generation) 
     platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00006000-0014053122A1801E 
     platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device 
    ** BUILD FAILED **


Xcode's output:
↳
    In file included from
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/javascriptChannelHandler.m:5:
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/JavaScriptChannelHandler.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/FLTWebViewFlutterPlugin.m:5:
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/FLTWebViewFlutterPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/FLTWKProgressionDelegate.m:5:
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/FLTWKProgressionDelegate.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/FLTWKNavigationDelegate.m:5:
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/FLTWKNavigationDelegate.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/FLTCookieManager.m:5:
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/FLTCookieManager.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/JavaScriptChannelHandler.m:5:
    /Users/christophevidal/Development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview
    -2.7.1/ios/Classes/JavaScriptChannelHandler.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order

Could not build the application for the simulator.
Error launching application on iPhone 13.

【问题讨论】:

flutter pub cache repair 没用 【参考方案1】:

第一步(打开IDE终端)

    android 工作室
    Visual Studio 代码

第二步(写flutter命令):-

    添加您的路径:- export PATH="$PATH:/Users/username/flutter/bin"

输入命令 2) 扑干净 3)颤振酒吧获取 4) cd ios 5) 吊舱安装或吊舱更新

第 3 步安装 cocoapods

1)打开终端(cmd+空格) 2)输入这个命令:- sudo gem install cocoapods

有关 cocoapods 的更多信息:- visit this site

第四步

再次打开 IDE 终端并输入 build ios。 我希望这对您有任何疑问问我有帮助。 谢谢。

【讨论】:

不幸的是无助于解决这个问题。我正在使用 macbook m1

以上是关于Flutter 运行和 ipa - Mac M1 - #import <Flutter/Flutter.h>的主要内容,如果未能解决你的问题,请参考以下文章

迁移到 M1 Mac 后在 iOS 上运行 Flutter App 时出错

尝试使用我的 m1 mac 运行我的 Flutter 应用程序时出错

在 M1 Mac 上运行 Flutter Doctor 时出错 - 无法找到捆绑的 Java 版本

m1版Mac运行Flutter项目报错:Kotlin could not find the required JDK tools in the Java ...

m1版Mac运行Flutter项目报错:Kotlin could not find the required JDK tools in the Java ...

Flutter 项目无法在 Mac M1 上构建