Flutter for iOS 运行,构建但不归档
Flutter for iOS run, build but not archive
我的应用存档完美两周(是我所做的最新更新)。
在对 flutter 代码进行了一些小的更改后(我没有添加任何包或其他东西),我试图再次存档并且我遇到了一些奇怪的错误而且我不知道来自哪里(那些来自库,所以没有真正的改变)。我可以在模拟器上 运行 它,而且我可以毫无问题地构建它。我只是无法存档。
这是错误:
Running Xcode build...
Xcode archive done. 80.5s
Failed to build iOS app
Error output from Xcode build:
↳
2022-03-20 00:27:32.265 xcodebuild[22543:393081] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension
Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-03-20 00:27:32.266 xcodebuild[22543:393081] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** ARCHIVE FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/lp/myd6ssb57_jg81p9920h5_sr0000gn/T/flutter_tools.AJZJFr/flutter_ios_build_temp_dir4zPWKc/temporary_xcresult_bundle
LLVM ERROR: out of memory
Allocation failed
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file
/Users/eae/Library/Developer/Xcode/DerivedData/Runner-cssekixerfgncvbcfrtqdpehzsfb/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/prin
ting.build/Objects-normal/arm64/PrintJob.bc -embed-bitcode -target arm64-apple-ios11.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name printing -o
/Users/eae/Library/Developer/Xcode/DerivedData/Runner-cssekixerfgncvbcfrtqdpehzsfb/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/prin
ting.build/Objects-normal/arm64/PrintJob.o
1. Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
2. Compiling with the current language version
3. Running pass 'Function Pass Manager' on module
'/Users/eae/Library/Developer/Xcode/DerivedData/Runner-cssekixerfgncvbcfrtqdpehzsfb/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/pri
nting.build/Objects-normal/arm64/PrintJob.bc'.
4. Running pass 'ObjC ARC contraction' on function '@UI_USER_INTERFACE_IDIOM'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000107437de7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1 swift-frontend 0x0000000107436e38 llvm::sys::RunSignalHandlers() + 248
2 swift-frontend 0x0000000107438440 SignalHandler(int) + 288
3 libsystem_platform.dylib 0x00007ff80f10cdfd _sigtramp + 29
4 libsystem_malloc.dylib 0x00007ff80ef2aabb _malloc_zone_malloc + 125
5 libsystem_c.dylib 0x00007ff80f042d24 abort + 123
6 swift-frontend 0x0000000107384cda llvm::report_bad_alloc_error(char const*, bool) + 106
7 swift-frontend 0x0000000107384cf2 out_of_memory_new_handler() + 18
8 libc++abi.dylib 0x00007ff80f0b496b operator new(unsigned long) + 43
9 swift-frontend 0x0000000107145efd llvm::Function::BuildLazyArguments() const + 77
10 swift-frontend 0x0000000104f2ee87 llvm::objcarc::BundledRetainClaimRVs::insertRVCallWithColors(llvm::Instruction*, llvm::CallBase*, llvm::DenseMap<llvm::BasicBlock*,
llvm::TinyPtrVector<llvm::BasicBlock*>, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, llvm::TinyPtrVector<llvm::BasicBlock*> > > const&) + 151
11 swift-frontend 0x0000000104f41f88 (anonymous namespace)::ObjCARCContract::run(llvm::Function&, llvm::AAResults*, llvm::DominatorTree*) + 1384
12 swift-frontend 0x000000010717d380 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1488
13 swift-frontend 0x0000000107184073 llvm::FPPassManager::runOnModule(llvm::Module&) + 67
14 swift-frontend 0x000000010717db39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1161
15 swift-frontend 0x000000010269b6df swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 3791
16 swift-frontend 0x000000010269c8cc swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*,
llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2812
17 swift-frontend 0x00000001026a5aa5 swift::performLLVM(swift::IRGenOptions const&, swift::ASTContext&, llvm::Module*, llvm::StringRef) + 213
18 swift-frontend 0x0000000102160795 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 16565
19 swift-frontend 0x000000010211f5d4 swift::mainEntry(int, char const**) + 1108
20 dyld 0x000000011690651e start + 462
error: Abort trap: 6 (in target 'printing' from project 'Pods')
error: backend command failed due to signal 6 (use -v to see invocation)
我试过以下方法:
在你项目的ios/文件夹中,将Podfile改为
平台:ios,'12.0'
运行 pod 在您项目的 ios/ 文件夹内的终端中解体。
运行 pod install --repo-update 在你的 ios/ 文件夹
来自 flutter 医生:
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.3 21E230 darwin-x64, locale en-ES)
• Flutter version 2.10.3 at /Users/eae/Flutter/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (2 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/eae/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] VS Code (version 1.65.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• iPhone 13 (mobile) • 50A38949-153E-4E22-AAF3-E96FC64DF2B5 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.74
[✓] HTTP Host Availability
• All required HTTP hosts are available
```
这是 Xcode 版本 13.3 中出现的问题。在 Xcode 13.3 中,如果您有使用 UI_USER_INTERFACE_IDIOM() 的代码,则在 运行 存档时会出现“内存不足”错误。
将“UI_USER_INTERFACE_IDIOM()”更改为“UIDevice.current.userInterfaceIdiom”可解决错误。
目前我们有以下解决方案。
- 修改代码,
- 降级到 Xcode 13.2.1
- 等待苹果修改Xcode
参考资料
在我的例子中,我将 UI_USER_INTERFACE_IDIOM() 替换为 UIDevice.current.userInterfaceIdiom。(您可以在 pods 文件夹中找到它)。我认为这发生在 Xcode 13.3
也检查这个
13.3的Xcode版本有这个问题,首先删除你当前的XCode应用。使用以下方法:
单击 Finder
图标 > 在边栏上,您会找到 Applications
,单击它,然后删除 Xcode
图标。这将从您的系统中完全删除 Xcode。重启你的 Mac.
安装 13.2.1 版本后,将 UI_USER_INTERFACE_IDIOM()
更改为 UIDevice.current.userInterfaceIdiom
,同时 运行 存档。
现在转到 Xcode Releases 页面并下载 Xcode 13.2.1
版本。
使用 13.2.1 版本,直到 Apple 解决此问题。
我的应用存档完美两周(是我所做的最新更新)。
在对 flutter 代码进行了一些小的更改后(我没有添加任何包或其他东西),我试图再次存档并且我遇到了一些奇怪的错误而且我不知道来自哪里(那些来自库,所以没有真正的改变)。我可以在模拟器上 运行 它,而且我可以毫无问题地构建它。我只是无法存档。
这是错误:
Running Xcode build...
Xcode archive done. 80.5s
Failed to build iOS app
Error output from Xcode build:
↳
2022-03-20 00:27:32.265 xcodebuild[22543:393081] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension
Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-03-20 00:27:32.266 xcodebuild[22543:393081] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** ARCHIVE FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/lp/myd6ssb57_jg81p9920h5_sr0000gn/T/flutter_tools.AJZJFr/flutter_ios_build_temp_dir4zPWKc/temporary_xcresult_bundle
LLVM ERROR: out of memory
Allocation failed
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file
/Users/eae/Library/Developer/Xcode/DerivedData/Runner-cssekixerfgncvbcfrtqdpehzsfb/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/prin
ting.build/Objects-normal/arm64/PrintJob.bc -embed-bitcode -target arm64-apple-ios11.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name printing -o
/Users/eae/Library/Developer/Xcode/DerivedData/Runner-cssekixerfgncvbcfrtqdpehzsfb/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/prin
ting.build/Objects-normal/arm64/PrintJob.o
1. Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
2. Compiling with the current language version
3. Running pass 'Function Pass Manager' on module
'/Users/eae/Library/Developer/Xcode/DerivedData/Runner-cssekixerfgncvbcfrtqdpehzsfb/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/pri
nting.build/Objects-normal/arm64/PrintJob.bc'.
4. Running pass 'ObjC ARC contraction' on function '@UI_USER_INTERFACE_IDIOM'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000107437de7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1 swift-frontend 0x0000000107436e38 llvm::sys::RunSignalHandlers() + 248
2 swift-frontend 0x0000000107438440 SignalHandler(int) + 288
3 libsystem_platform.dylib 0x00007ff80f10cdfd _sigtramp + 29
4 libsystem_malloc.dylib 0x00007ff80ef2aabb _malloc_zone_malloc + 125
5 libsystem_c.dylib 0x00007ff80f042d24 abort + 123
6 swift-frontend 0x0000000107384cda llvm::report_bad_alloc_error(char const*, bool) + 106
7 swift-frontend 0x0000000107384cf2 out_of_memory_new_handler() + 18
8 libc++abi.dylib 0x00007ff80f0b496b operator new(unsigned long) + 43
9 swift-frontend 0x0000000107145efd llvm::Function::BuildLazyArguments() const + 77
10 swift-frontend 0x0000000104f2ee87 llvm::objcarc::BundledRetainClaimRVs::insertRVCallWithColors(llvm::Instruction*, llvm::CallBase*, llvm::DenseMap<llvm::BasicBlock*,
llvm::TinyPtrVector<llvm::BasicBlock*>, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, llvm::TinyPtrVector<llvm::BasicBlock*> > > const&) + 151
11 swift-frontend 0x0000000104f41f88 (anonymous namespace)::ObjCARCContract::run(llvm::Function&, llvm::AAResults*, llvm::DominatorTree*) + 1384
12 swift-frontend 0x000000010717d380 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1488
13 swift-frontend 0x0000000107184073 llvm::FPPassManager::runOnModule(llvm::Module&) + 67
14 swift-frontend 0x000000010717db39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1161
15 swift-frontend 0x000000010269b6df swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 3791
16 swift-frontend 0x000000010269c8cc swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*,
llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2812
17 swift-frontend 0x00000001026a5aa5 swift::performLLVM(swift::IRGenOptions const&, swift::ASTContext&, llvm::Module*, llvm::StringRef) + 213
18 swift-frontend 0x0000000102160795 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 16565
19 swift-frontend 0x000000010211f5d4 swift::mainEntry(int, char const**) + 1108
20 dyld 0x000000011690651e start + 462
error: Abort trap: 6 (in target 'printing' from project 'Pods')
error: backend command failed due to signal 6 (use -v to see invocation)
我试过以下方法:
在你项目的ios/文件夹中,将Podfile改为
平台:ios,'12.0'
运行 pod 在您项目的 ios/ 文件夹内的终端中解体。
运行 pod install --repo-update 在你的 ios/ 文件夹
来自 flutter 医生:
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.3 21E230 darwin-x64, locale en-ES)
• Flutter version 2.10.3 at /Users/eae/Flutter/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (2 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/eae/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] VS Code (version 1.65.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• iPhone 13 (mobile) • 50A38949-153E-4E22-AAF3-E96FC64DF2B5 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.74
[✓] HTTP Host Availability
• All required HTTP hosts are available
```
这是 Xcode 版本 13.3 中出现的问题。在 Xcode 13.3 中,如果您有使用 UI_USER_INTERFACE_IDIOM() 的代码,则在 运行 存档时会出现“内存不足”错误。 将“UI_USER_INTERFACE_IDIOM()”更改为“UIDevice.current.userInterfaceIdiom”可解决错误。
目前我们有以下解决方案。
- 修改代码,
- 降级到 Xcode 13.2.1
- 等待苹果修改Xcode
参考资料
在我的例子中,我将 UI_USER_INTERFACE_IDIOM() 替换为 UIDevice.current.userInterfaceIdiom。(您可以在 pods 文件夹中找到它)。我认为这发生在 Xcode 13.3
也检查这个
13.3的Xcode版本有这个问题,首先删除你当前的XCode应用。使用以下方法:
单击 Finder
图标 > 在边栏上,您会找到 Applications
,单击它,然后删除 Xcode
图标。这将从您的系统中完全删除 Xcode。重启你的 Mac.
安装 13.2.1 版本后,将 UI_USER_INTERFACE_IDIOM()
更改为 UIDevice.current.userInterfaceIdiom
,同时 运行 存档。
现在转到 Xcode Releases 页面并下载 Xcode 13.2.1
版本。
使用 13.2.1 版本,直到 Apple 解决此问题。