Flutter dependencies are deprecated in iOS

Viewed 2328

I know many Flutter developers use lots of different packages in their applications. Nowadays, I'm trying to build a final version of my app in iOS but it gives me headache. I'm using packages such as image_picker, flutter_local_notifications, flutter_inappwebview, firebase_messaging etc. Due to compatibility issue on Firebase libraries, I need to target min. iOS 10.0.

These are the versions of some libraries that give errors when building to iOS on Simulator.

image_picker: ^0.6.7+22
flutter_local_notifications: ^4.0.1
flutter_inappwebview: ^4.0.0+4

# Only Firebase_messaging gives errors between Firebase libraries but 
# I would like to show you the versions of all of them
firebase_admob: ^0.11.0+1
firebase_messaging:
firebase_core: ^0.7.0
firebase_auth: ^0.20.0+1
cloud_firestore: ^0.16.0

A little part of warnings related to firebase_messaging


    In module 'UIKit' imported from /Users/zahidtekbas/Documents/GitHub/projectxyz-Flutter-App/projectxyz/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Li
    brary/Frameworks/UIKit.framework/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/zahidtekbas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin
    .m:294: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/zahidtekbas/Documents/GitHub/projectxyz-Flutter-App/projectxyz/ios/Pods/Target Support
    Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Li
    brary/Frameworks/UIKit.framework/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
    explicitly marked deprecated here
    typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
                                   ^
    /Users/zahidtekbas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin
    .m:295:70: warning: 'UIUserNotificationTypeAlert' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications
    Framework's UNAuthorizationOptions [-Wdeprecated-declarations]
        @"alert" : [NSNumber numberWithBool:notificationSettings.types & UIUserNotificationTypeAlert],

And there are these kind of deprecated methods, deprecated UI elements errors in warning output. When I target min. iOS 9.0, this time GoogleMobilAds, FirebaseInstanceID, flutter_inappwebview-4.0.0+4 etc. give errors.

So I can't avoid errors and warnings when building for iOS no matter what platform I'm targeting. Any idea how to solve the long paragraphs of error messages due to deprecated stuff?

Edit: I'm adding output of flutter doctor -v


[✓] Flutter (Channel beta, 1.26.0-17.8.pre, on macOS 11.2 20D64 darwin-x64, locale en-TR)
    • Flutter version 1.26.0-17.8.pre at /Users/zahidtekbas/flutter
    • Framework revision 044f2cf560 (3 days ago), 2021-02-24 13:02:05 -0800
    • Engine revision 042c82b02c
    • Dart version 2.12.0 (build 2.12.0-259.16.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/zahidtekbas/Library/Android/sdk
    • Platform android-30, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 53.0.5
    • Dart plugin version 203.6912

[✓] VS Code (version 1.53.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.4.1

[✓] Connected device (2 available)
    • iPhone 12 Pro Max (mobile) • 943E0837-6EB7-45F6-B9F0-EC00160B2CDE • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 88.0.4324.192

End of the build output:


    4 warnings generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team
    ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')

2 Answers

I got same issue, even i minimumOSVersion was set to 11.0 , and IPHONEOS_DEPLOYMENT_TARGET set to 11.0 , error deprecated still show, maybe ploblem with Xcode , btw i use Xcode 12.4 and 12.2 still error

Upgrading to new Flutter version solved my problem. If anyone see this, consider upgrading your dependencies and Flutter.

Related