Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
firebase_消息无法为iOS构建,但适用于Android_Ios_Firebase_Flutter_Firebase Cloud Messaging_Firebase Notifications - Fatal编程技术网

firebase_消息无法为iOS构建,但适用于Android

firebase_消息无法为iOS构建,但适用于Android,ios,firebase,flutter,firebase-cloud-messaging,firebase-notifications,Ios,Firebase,Flutter,Firebase Cloud Messaging,Firebase Notifications,我希望添加firebase_messaging 7.0.3包,将推送通知添加到我的项目中。我已经为安卓系统配置了它,它工作起来很有魅力。获取注册令牌并可以将通知推送到我的仿真器和手机没有问题 现在,当我运行iOS构建时,它无法找到“firmMessageDelegate”的协议声明。据我所知,FIR-前缀已在一段时间前删除,现在应称为MessagingDelegate 我已经运行了pod安装和更新,并尝试了清理颤振 flutter clean pod install pod update

我希望添加
firebase_messaging 7.0.3
包,将推送通知添加到我的项目中。我已经为安卓系统配置了它,它工作起来很有魅力。获取注册令牌并可以将通知推送到我的仿真器和手机没有问题

现在,当我运行iOS构建时,它无法找到“firmMessageDelegate”的协议声明。据我所知,
FIR-
前缀已在一段时间前删除,现在应称为MessagingDelegate

我已经运行了pod安装和更新,并尝试了清理颤振

flutter clean 
pod install 
pod update 
此外,尝试将
Firebase消息
添加到我的Podfile版本中,但尝试较旧版本无效

我遵循了iOS配置中的所有步骤:并尝试了方法swizzling和Nothing。我已经没有办法尝试了,也许有些依赖项没有在某处使用正确版本的firebase,但我真的不确定如何检查这些

以下是生成的堆栈跟踪:

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 information 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