Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
539 views
in Technique[技术] by (71.8m points)

swift - Flutter [firebase_messaging] IOS Build Error [SOLVED]

I have a problem with Firebase Messaging (https://pub.dev/packages/firebase_messaging). I can't build in IOS after add this to project.

I tried:

flutter clean
flutter precache    
pod deintegrate
pod setup
pod install

Tried: Remove Podfile.lock

Edit/Remove WorkspaceSettings.xcsettings

Change the build system to Legacy

I have same problem in my real project. I created the blank project , build ios and run on simulator. After i add the FirebaseMessaging get this build errors. Tried the methods what i text but didn't work for me. Errors :

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/iP

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

SOLVED!

It resolved with run this commands :

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...