首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没有名为'FlutterPluginRegistrar‘的类型或协议

没有名为'FlutterPluginRegistrar‘的类型或协议
EN

Stack Overflow用户
提问于 2020-09-12 05:48:13
回答 1查看 878关注 0票数 2

ios上的颤动问题在XCode中,一些库(SharedPreferences、苹果登录)显示错误:

No type or protocol named 'FlutterPluginRegistrar'

我已经尝试过了: flutter清理,pod更新,我清理了pub-cache并重新安装了所有的库,我唯一没有做的就是删除ios项目的pod文件夹(我做了一次,然后我无法恢复项目)

代码语言:javascript
复制
** 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
EN

回答 1

Stack Overflow用户

发布于 2021-02-01 19:38:05

我已经在这个问题上挣扎了一段时间,我发现来自here的eleomilagrosa的解决方案是有效的:

代码语言:javascript
复制
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.
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63854708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档