Flutter Apple 硅致命 Shared_preferences 错误:找不到“Flutter/Flutter.h”文件

时间:2021-02-16 17:59:14

标签: xcode flutter dart

我的 Flutter 项目使用的是 Apple Silicon mac,但在将我的程序传递到我的新计算机后遇到了问题。

Xcode's output:
↳
In file included from /Users/gorkem/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.m:5:
    /Users/gorkem/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: the following command failed with exit code 1 but produced no further output
    CompileC /Users/gorkem/Library/Developer/Xcode/DerivedData/Runner-ghjviwzylhbejhfsayqxcrbfzwyc/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/local_auth.build/Objects-normal/x86_64/FLTLocalAuthPlugin.o /Users/gorkem/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/local_auth-0.6.3+4/ios/Classes/FLTLocalAuthPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    Command CompileSwift failed with a nonzero exit code
note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'shared_preferences' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'vibration' from project 'Pods')

我认为问题来自共享首选项包中的文件 flutter.h。 这是问题的一部分。如果您需要更多,我可以随时编辑。 我已经做了很多与这个问题相关的事情,但显然,它没有用。如果你有建议,我会听的。 顺便说一句,我尝试了 flutter clean 然后重新运行,尝试更新所有软件包。它们都不起作用。

1 个答案:

答案 0 :(得分:1)

尝试从您的项目中删除 CocoaPod

cd ios
pod deintegrate
flutter clean
flutter run

如果这不起作用,请尝试重新安装 flutter 或切换到 beta 频道