问题描述
我希望添加 firebase_messaging 7.0.3
包以将推送通知添加到我的项目中。我已经为 Android 配置了它,它就像一个魅力。获取注册令牌并可以将通知推送到我的模拟器和手机没问题。@H_502_3@
现在,当我运行 iOS 构建时,它无法找到“FIRMessagingDelegate”的协议声明。据我了解,FIR-
前缀已于前一段时间被删除,现在应该被称为 MessagingDelegate。@H_502_3@
我运行了 pod install 和 update 并尝试清理 Flutter。@H_502_3@
Flutter clean
pod install
pod update
另外,尝试将 Firebase-Messaging
添加到我的 Podfile 版本较少,但尝试旧版本无济于事。@H_502_3@
我按照 iOS 配置中的所有步骤进行操作:https://pub.dev/packages/firebase_messaging 并尝试使用方法 swizzling 和不使用方法。我已经没有办法尝试了,也许某些依赖项在某个地方没有使用正确版本的 firebase,但我不确定如何检查这些。@H_502_3@
这是构建中的堆栈跟踪:@H_502_3@
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done. 56.0s
Failed to build iOS app
Error output from Xcode build:
↳
2021-02-08 16:55:26.766 xcodebuild[37625:1544731] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-17705/DTDeviceKitBase/DTDKRemoteDeviceData.m:371
Details: (null) deviceType from 00008030-000E78DC3C81802E was NULL when -platform called.
Object: <DTDKMobileDevicetoken: 0x7fdc6daa9710>
Method: -platform
Thread: <NSThread: 0x7fdc6d00f3d0>{number = 2,name = (null)}
Please file a bug at https://Feedbackassistant.apple.com with this warning message and any useful @R_115_4045@ion you can provide.
** BUILD Failed **
Xcode's output:
↳
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:14:43: error: cannot find protocol declaration for 'FIRMessagingDelegate'
@interface FLTFirebaseMessagingPlugin () <FIRMessagingDelegate>
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:190:43: error: expected a type
- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:284:28: error: expected a type
- (void)messaging:(nonnull FIRMessaging *)messaging
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:289:20: error: expected a type
- (void)messaging:(FIRMessaging *)messaging
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:290:24: error: expected a type
didReceiveMessage:(FIRMessagingRemoteMessage *)remoteMessage {
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:55:6: error: use of undeclared identifier 'FIRMessaging'
[FIRMessaging messaging].delegate = self;
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:136:6: error: use of undeclared identifier 'FIRMessaging'
[FIRMessaging messaging].shouldEstablishDirectChannel = true;
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:144:7: error: use of undeclared identifier 'FIRMessaging'
[[FIRMessaging messaging] subscribetoTopic:topic
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:150:7: error: use of undeclared identifier 'FIRMessaging'
[[FIRMessaging messaging] unsubscribeFromTopic:topic
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:155:21: warning: 'FIRInstanceID' is deprecated: FIRInstanceID is deprecated,please use FIRInstallations for installation identifier handling and use FIRMessaging for FCM registration token handling. [-Wdeprecated-declarations]
[[FIRInstanceID instanceID]
^
In module 'FirebaseInstanceID' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Headers/Public/Firebase/Firebase.h:72:
/Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:190:1: note: 'FIRInstanceID' has been explicitly marked deprecated here
__deprecated_msg("FIRInstanceID is deprecated,please use FIRInstallations for installation "
^
In module 'UIKit' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:156:33: warning: 'FIRInstanceIDResult' is deprecated: FIRInstanceIDResult is deprecated,please use FIRInstallations for app instance identifier handling and use FIRMessaging for FCM registration token handling. [-Wdeprecated-declarations]
instanceIDWithHandler:^(FIRInstanceIDResult *_Nullable instanceIDResult,^
In module 'FirebaseInstanceID' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Headers/Public/Firebase/Firebase.h:72:
/Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:153:1: note: 'FIRInstanceIDResult' has been explicitly marked deprecated here
__deprecated_msg("FIRInstanceIDResult is deprecated,please use FIRInstallations "
^
In module 'UIKit' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:156:9: warning: 'instanceIDWithHandler:' is deprecated: Use `Installations.installationID(completion:)` to get the app instance identifier instead. Use `Messaging.token(completion:)` to get FCM registration token instead. [-Wdeprecated-declarations]
instanceIDWithHandler:^(FIRInstanceIDResult *_Nullable instanceIDResult,^
In module 'FirebaseInstanceID' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Headers/Public/Firebase/Firebase.h:72:
/Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:215:5: note: 'instanceIDWithHandler:' has been explicitly marked deprecated here
__deprecated_msg("Use `Installations.installationID(completion:)` to get the app instance "
^
In module 'UIKit' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:166:21: warning: 'FIRInstanceID' is deprecated: FIRInstanceID is deprecated,please use FIRInstallations for installation identifier handling and use FIRMessaging for FCM registration token handling. [-Wdeprecated-declarations]
[[FIRInstanceID instanceID] deleteIDWithHandler:^void(NSError *_Nullable error) {
^
In module 'FirebaseInstanceID' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Headers/Public/Firebase/Firebase.h:72:
/Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:190:1: note: 'FIRInstanceID' has been explicitly marked deprecated here
__deprecated_msg("FIRInstanceID is deprecated,please use FIRInstallations for installation "
^
In module 'UIKit' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:166:33: warning: 'deleteIDWithHandler:' is deprecated: Use `Installations.delete(completion:)` instead. Also check `Messaging.deleteData(completion:)`if you want to delete FCM registration token. [-Wdeprecated-declarations]
[[FIRInstanceID instanceID] deleteIDWithHandler:^void(NSError *_Nullable error) {
^
In module 'FirebaseInstanceID' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Headers/Public/Firebase/Firebase.h:72:
/Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:321:33: note: 'deleteIDWithHandler:' has been explicitly marked deprecated here
__deprecated_msg("Use `Installations.delete(completion:)` instead. "
^
In module 'UIKit' imported from /Users/peterpoliwoda/Development/git/bd4qol_mobile_app/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:176:20: error: use of undeclared identifier 'FIRMessaging'
BOOL value = [[FIRMessaging messaging] isAutoInitEnabled];
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:180:6: error: use of undeclared identifier 'FIRMessaging'
[FIRMessaging messaging].autoInitEnabled = value.boolValue;
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:191:52: error: property 'appData' not found on object of type '__strong id'
[self didReceiveRemoteNotification:remoteMessage.appData];
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:204:7: error: use of undeclared identifier 'FIRMessaging'
[[FIRMessaging messaging] appDidReceiveMessage:userInfo];
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:263:5: error: use of undeclared identifier 'FIRMessaging'
[[FIRMessaging messaging] setAPNSToken:devicetoken type:FIRMessagingAPNSTokenTypeSandBox];
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:268:48: error: use of undeclared identifier 'FIRMessaging'
[_channel invokeMethod:@"onToken" arguments:[FIRMessaging messaging].FCMToken];
^
/Users/peterpoliwoda/Development/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:291:63: error: property 'appData' not found on object of type '__strong id'
[_channel invokeMethod:@"onMessage" arguments:remoteMessage.appData];
^
5 warnings and 16 errors generated.
$ Flutter --version
Flutter 1.22.6 • channel stable • https://github.com/Flutter/Flutter.git
Framework • revision 9b2d32b605 (3 weeks ago) • 2021-01-22 14:36:39 -0800
Engine • revision 2f0af37152
Tools • Dart 2.10.5
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)