Flutter [firebase_messaging] IOS 构建错误

5

我在使用Firebase Messaging时遇到了问题(https://pub.dev/packages/firebase_messaging)。添加到项目后,我无法在IOS上构建。

我尝试过:

flutter clean
flutter precache    
pod deintegrate
pod setup
pod install

尝试过以下方法:

1. 删除 Podfile.lock 文件

2. 编辑/删除 WorkspaceSettings.xcsettings 文件

3. 将构建系统更改为 Legacy(传统)

我在真实项目中也遇到了同样的问题。我创建了一个空白项目,在模拟器上构建 iOS 并运行。之后添加 FirebaseMessaging 后出现了这些构建错误。我尝试了前面提到的方法,但对我无效。错误信息如下:

In file included from /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:9:
    /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Headers/Public/Firebase/Firebase.h:81:10: warning: "FirebaseAnalytics.framework is not
    included in your target. Please add the FirebaseAnalytics dependency to your project to ensure Messaging works as intended." [-W#warnings]
            #warning "FirebaseAnalytics.framework is not included in your target. Please add the \
             ^
    /Users/mac/.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/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:274:42: warning:
    'UIUserNotificationSettings' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationSettings
    [-Wdeprecated-declarations]
        didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
                                             ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:44:12: note: 'UIUserNotificationSettings' has been explicitly marked deprecated here
    @interface UIUserNotificationSettings : NSObject
               ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:285:53: error: nullability
    specifier 'nonnull' conflicts with existing specifier 'nullable'
        didReceiveRegistrationToken:(nonnull NSString *)fcmToken {
                                                        ^
    /Users/mac/.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/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:117:7: warning:
    'UIUserNotificationType' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNAuthorizationOptions
    [-Wdeprecated-declarations]
          UIUserNotificationType notificationTypes = 0;
          ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:119:30: warning:
    'UIUserNotificationTypeSound' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNAuthorizationOptions
    [-Wdeprecated-declarations]
            notificationTypes |= UIUserNotificationTypeSound;
                                 ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:122:30: warning:
    'UIUserNotificationTypeAlert' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNAuthorizationOptions
    [-Wdeprecated-declarations]
            notificationTypes |= UIUserNotificationTypeAlert;
                                 ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:125:30: warning:
    'UIUserNotificationTypeBadge' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNAuthorizationOptions
    [-Wdeprecated-declarations]
            notificationTypes |= UIUserNotificationTypeBadge;
                                 ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:128:7: warning:
    'UIUserNotificationSettings' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationSettings
    [-Wdeprecated-declarations]
          UIUserNotificationSettings *settings =
          ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:44:12: note: 'UIUserNotificationSettings' has been explicitly marked deprecated here
    @interface UIUserNotificationSettings : NSObject
               ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:129:39: warning:
    'UIUserNotificationSettings' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationSettings
    [-Wdeprecated-declarations]
              [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil];
                                          ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:44:12: note: 'UIUserNotificationSettings' has been explicitly marked deprecated here
    @interface UIUserNotificationSettings : NSObject
               ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:130:42: warning:
    'registerUserNotificationSettings:' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's
    -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:] and -[UNUserNotificationCenter setNotificationCategories:]
    [-Wdeprecated-declarations]
          [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
                                             ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIApplication.h:250:1: note: 'registerUserNotificationSettings:' has been explicitly marked deprecated here
    - (void)registerUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings API_DEPRECATED("Use UserNotifications Framework's
    -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:] and -[UNUserNotificationCenter setNotificationCategories:]",
    ios(8.0, 10.0)) API_UNAVAILABLE(tvos);
    ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:136:30: error: property
    'shouldEstablishDirectChannel' not found on object of type 'FIRMessaging *'
        [FIRMessaging messaging].shouldEstablishDirectChannel = true;
                                 ^
    /Users/mac/.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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
    /Users/mac/Desktop/Flutter Apps/iyifiyatt/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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/Foundation.f
    ramework/Headers/Foundation.h:6:
    In module 'Darwin' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/CoreFoundati
    on.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/include/sys/cdefs.h:200:48: note:
    expanded from macro '__deprecated_msg'
            #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                          ^
    /Users/mac/.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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
    /Users/mac/Desktop/Flutter Apps/iyifiyatt/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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/Foundation.f
    ramework/Headers/Foundation.h:6:
    In module 'Darwin' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/CoreFoundati
    on.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/include/sys/cdefs.h:200:48: note:
    expanded from macro '__deprecated_msg'
            #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                          ^
    /Users/mac/.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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
    /Users/mac/Desktop/Flutter Apps/iyifiyatt/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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/Foundation.f
    ramework/Headers/Foundation.h:6:
    In module 'Darwin' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/CoreFoundati
    on.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/include/sys/cdefs.h:200:48: note:
    expanded from macro '__deprecated_msg'
            #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                          ^
    /Users/mac/.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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
    /Users/mac/Desktop/Flutter Apps/iyifiyatt/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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/Foundation.f
    ramework/Headers/Foundation.h:6:
    In module 'Darwin' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/CoreFoundati
    on.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/include/sys/cdefs.h:200:48: note:
    expanded from macro '__deprecated_msg'
            #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                          ^
    /Users/mac/.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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
    /Users/mac/Desktop/Flutter Apps/iyifiyatt/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/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/Foundation.f
    ramework/Headers/Foundation.h:6:
    In module 'Darwin' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/CoreFoundati
    on.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/include/sys/cdefs.h:200:48: note:
    expanded from macro '__deprecated_msg'
            #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                          ^
    /Users/mac/.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/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:273:1: warning: implementing
    deprecated method [-Wdeprecated-implementations]
    - (void)application:(UIApplication *)application
    ^
    In module 'Flutter' imported from
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.h:5:
    /Users/mac/Downloads/flutter/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-armv7_arm64/Flutter.framework/Headers/FlutterPlug
    in.h:74:1: note: method 'application:didRegisterUserNotificationSettings:' declared here
    - (void)application:(UIApplication*)application
    ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:276:70: warning:
    'UIUserNotificationTypeSound' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNAuthorizationOptions
    [-Wdeprecated-declarations]
        @"sound" : [NSNumber numberWithBool:notificationSettings.types & UIUserNotificationTypeSound],
                                                                         ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:277:70: warning:
    'UIUserNotificationTypeBadge' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNAuthorizationOptions
    [-Wdeprecated-declarations]
        @"badge" : [NSNumber numberWithBool:notificationSettings.types & UIUserNotificationTypeBadge],
                                                                         ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/mac/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:278:70: warning:
    'UIUserNotificationTypeAlert' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNAuthorizationOptions
    [-Wdeprecated-declarations]
        @"alert" : [NSNumber numberWithBool:notificationSettings.types & UIUserNotificationTypeAlert],
                                                                         ^
    In module 'UIKit' imported from /Users/mac/Desktop/Flutter Apps/iyifiyatt/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/System/Library/Frameworks/UIKit.framew
    ork/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/mac/.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];
                                                                  ^
    18 warnings and 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.

我遇到了同样的问题。你找到解决方法了吗? - Junaid Lodhi
2
@JunaidLodhi 已通过运行以下命令解决:`rm -rf Podsrm -rf Podfile.lockrm -rf ~/.pub-cache/hosted/pub.dartlang.org/flutter cleanflutter pub getpod repo updateflutter build ios` - Baran Gungor
感谢您,将翻译后的文本作为答案发布。 - Shalabyer
1
变量(variable) - Baran Gungor
1个回答

8

问题已解决!

通过运行以下命令解决:

rm -rf Pods  
rm -rf Podfile.lock  
rm -rf ~/.pub-cache/hosted/pub.dartlang.org/  
flutter clean  
flutter pub get  
pod repo update  
flutter build ios

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接