No type or protocol named 'FlutterPluginRegistrar'
1,129
I've struggled with this for some time, and I've found that eleomilagrosa's solution from here works:
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.
Author by
Darwin Castillo
Updated on December 24, 2022Comments
-
Darwin Castillo over 1 year
Flutter issues on ios In XCode, Some library (SharedPreferences, Apple Sign-In) is showing errors:
No type or protocol named 'FlutterPluginRegistrar'
I already tried with: flutter clean, pod update, I cleaned pub-cache and reinstalled all the libraries, the only thing I did not do is delete the pod folder of the ios project (I did it once and then I could not recover the project)
** 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
-
Farhana Naaz Ansari over 3 yearsdid you resolve this issue?
-
Darwin Castillo over 3 yearsyes, first i update flutter, update all libraries in pubspec.yaml, clean again pub-cache, remove pods, and re-install pods (pod install).
-
Farhana Naaz Ansari over 3 yearsthanks, I had to make another project and paste all code there.
-
Darwin Castillo over 3 yearsi have another problem, about sign in apple and apple store review, but isn't about this issue
-