ios上的颤动问题在XCode中,一些库(SharedPreferences、苹果登录)显示错误:
No type or protocol named 'FlutterPluginRegistrar'
我已经尝试过了: flutter清理,pod更新,我清理了pub-cache并重新安装了所有的库,我唯一没有做的就是删除ios项目的pod文件夹(我做了一次,然后我无法恢复项目)

** BUILD FAILED **
Xcode's output:
↳
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
In file included from
/Users/zippyttech/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreferencesPlugin.m:5
:
/Users/zippyttech/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreferencesPlugin.h:7
:51: error: no type or protocol named 'FlutterPlugin'
@interface FLTSharedPreferencesPlugin : NSObject <FlutterPlugin>
^
/Users/zippyttech/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreferencesPlugin.m:1
1:41: error: no type or protocol named 'FlutterPluginRegistrar'
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
^
/Users/zippyttech/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreferencesPlugin.m:1
2:3: error: use of undeclared identifier 'FlutterMethodChannel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/zippyttech/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreferencesPlugin.m:1
2:25: error: use of undeclared identifier 'channel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/zippyttech/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreferencesPlugin.m:1
2:36: error: use of undeclared identifier 'FlutterMethodChannel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/zippyttech/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreferencesPlugin.m:1
4:4: error: use of undeclared identifier 'channel'
[channel setMethodCallHandler:^(FlutterMethodCall *call, FlutterResult result) {
^
6 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.```
Flutter Version: Flutter 1.20.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 216dee60c0 (10 days ago) • 2020-09-01 12:24:47 -0700
Engine • revision d1bc06f032
Tools • Dart 2.9.2
apple_sign_in: ^0.1.0
shared_preferences: ^0.5.10发布于 2021-02-01 19:38:05
我已经在这个问题上挣扎了一段时间,我发现来自here的eleomilagrosa的解决方案是有效的:
I found out that the ios/Flutter/Flutter.framework got corrupted the files were all empty or blank.
to fix it,just copy existing ios/Flutter/Flutter.framework from other working Flutter projects you have.
then overwrite the corrupted ios/Flutter/Flutter.framework then build again
Reason:
Flutter.framework got corrupted.
How to identify if your Flutter.framework got corrupted?
open ios/Flutter/Flutter.framework/Headers/Flutter.h if this file is empty or blank.https://stackoverflow.com/questions/63854708
复制相似问题