0

我刚刚将 firebase_core 导入到您打开一个新的颤振项目时获得的普通应用程序中,并且该应用程序启动正常。接下来,我将 firebase_messaging 添加到 pubspec.yaml 中,这导致应用程序无法启动并产生错误。任何帮助是极大的赞赏。这是产生的错误:

Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:114:43: error: expected a
    type
    - (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage
    *)remoteMessage {
                                              ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:180: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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:44:12: note: 'UIUserNotificationSettings' has been
    explicitly marked deprecated here
    @interface UIUserNotificationSettings : NSObject
               ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:190:53: error: nullability
    specifier 'nonnull' conflicts with existing specifier 'nullable'
        didReceiveRegistrationToken:(nonnull NSString *)fcmToken {
                                                        ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:49:5: 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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:52:28: 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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:55:28: 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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:58:28: 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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:60:5: 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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:44:12: note: 'UIUserNotificationSettings' has been
    explicitly marked deprecated here
    @interface UIUserNotificationSettings : NSObject
               ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:61:37: 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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:44:12: note: 'UIUserNotificationSettings' has been
    explicitly marked deprecated here
    @interface UIUserNotificationSettings : NSObject
               ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:62:40: 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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/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/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:80:7: error: use of
    undeclared identifier 'FIRInstanceID'
        [[FIRInstanceID instanceID]
          ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:91:7: error: use of
    undeclared identifier 'FIRInstanceID'
        [[FIRInstanceID instanceID] deleteIDWithHandler:^void(NSError *_Nullable
        error) {
          ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:115:52: error: property
    'appData' not found on object of type '__strong id'
      [self didReceiveRemoteNotification:remoteMessage.appData];
                                                       ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:179:1: warning: implementing
    deprecated method [-Wdeprecated-implementations]
    - (void)application:(UIApplication *)application
    ^
    In module 'Flutter' imported from
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.h:5:
    /Users/alfieanil/Developer/flutter/bin/cache/artifacts/engine/ios/Flutter.xcframew
    ork/ios-arm64_x86_64-simulator/Flutter.framework/Headers/FlutterPlugin.h:74:1:
    note: method 'application:didRegisterUserNotificationSettings:' declared here
    - (void)application:(UIApplication*)application
    ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:182: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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:183: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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/alfieanil/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_mes
    saging-4.0.0+4/ios/Classes/FirebaseMessagingPlugin.m:184: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/alfieanil/Documents/Church
    App/App/SwiftTest/another/RELEASES/Primary
    Release/IOS/redo_backup/redo_ios/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Deve
    loper/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Heade
    rs/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    12 warnings and 5 errors generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 11.
4

0 回答 0