Geo*_*lex 17 ios flutter apple-m1
我尝试在带有 M1 芯片的新 Mac 上构建现有的 flutter 项目。\n由于缺少 audio_session 模块,我遇到以下错误。
\nLaunching lib/main.dart on iPhone 12 in debug mode...\nRunning Xcode build... \n \xe2\x94\x94\xe2\x94\x80Compiling, linking and signing... 340ms\nXcode build done. 4.7s\nFailed to build iOS app\nError output from Xcode build:\n\xe2\x86\xb3\n objc[7636]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f2fe0188) and ?? (0x117e8c2b8). One of the two will be used. Which one is undefined.\n objc[7636]: Class AMSupportURLSession is implemented in both ?? (0x1f2fe01d8) and ?? (0x117e8c308). One of the two will be used. Which one is undefined.\n ** BUILD FAILED **\n\n\nXcode's output:\n\xe2\x86\xb3\n /Users/user/Projects/myproject/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'audio_session' not found\n @import audio_session;\n ~~~~~~~^~~~~~~~~~~~~\n 1 error generated.\n note: Using new build system\n note: Building targets in parallel\n note: Planning build\n note: Constructing build description\n\nCould not build the application for the simulator.\nError launching application on iPhone 12.\nRun Code Online (Sandbox Code Playgroud)\n有什么想法吗?
\n最后找到了解决办法。
\n不知何故,如果我进入我的 flutter 项目的 iOS 文件夹并输入 \'pod init; pod install\' 生成了一个基本的 Podfile(意味着它仅指定了平台)。
\n我在某个地方发现了一个帖子,建议删除 iOS 文件夹中有关 pod 的所有内容,并在项目中运行 flutter run。在项目文件夹中运行“flutter run”(也集成了“pod install”),生成了一个非常详细的 Podfile,但这次我遇到了另一个与平台有关的错误(如下所列)。
\nError output from CocoaPods:\n\xe2\x86\xb3\n\n [!] Automatically assigning platform `iOS` with version `12.0` on target\n `Runner` because no platform was specified. Please specify a platform for\n this target in your Podfile. See\n `https://guides.cocoapods.org/syntax/podfile.html#platform`.\n\nError: To set up CocoaPods for ARM macOS, run:\n arch -x86_64 sudo gem install ffi\nRun Code Online (Sandbox Code Playgroud)\n我尝试按照建议运行上面显示的命令,但出现了同样的错误。
\n然后,我在这里找到了Running Cocoapods on Apple Silicon (M1) 的答案,该答案与官方文档https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon类似。
\n即便如此,堆栈溢出的答案对我来说并没有直接起作用,直到我按照以下步骤操作:
\n我希望这对其他人有用。
\n| 归档时间: |
|
| 查看次数: |
14506 次 |
| 最近记录: |