firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.54k stars 3.93k forks source link

🐛 [firebase_app_check/code-unsupported] The operation couldn’t be completed. The attestation provider DeviceCheckProvider is not supported on current platform and OS version. #12263

Closed icorradi-inco closed 1 month ago

icorradi-inco commented 6 months ago

Bug report

Describe the bug

It's not possible to test app_check on the iOS Simulator. I have already followed all the steps and entered the debug token on Firebase Console, as described here: https://firebase.google.com/docs/app-check/flutter/debug-provider

Steps to reproduce

Steps to reproduce the behavior:

  1. Just initialize app_check.

Expected behavior

The token must be generated.

Sample project

  await Firebase.initializeApp();
  await FirebaseAuth.instance.signInAnonymously();
  await FirebaseAppCheck.instance.activate(
    appleProvider: AppleProvider.debug,
  );

  String? firebaseAppCheckToken = await FirebaseAppCheck.instance.getToken();

Response:

A Dart VM Service on iPhone 15 Pro Max is available at: http://127.0.0.1:55264/ckYtMzf8UA8=/
The Flutter DevTools debugger and profiler on iPhone 15 Pro Max is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:55264/ckYtMzf8UA8=/
Firebase App Check Debug Token: 6BB3D44E-6CBA-42D9-A312-77D2F7578D0C
flutter: [firebase_app_check/code-unsupported] The operation couldn’t be completed. The attestation provider DeviceCheckProvider is not supported on current platform and OS version.

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` Doctor summary (to see all details, run flutter doctor -v): [!] Flutter (Channel [user-branch], 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale en-BR) ! Flutter version 3.13.9 on channel [user-branch] at /usr/local/flutter Currently on an unknown channel. Run `flutter channel` to switch to an official channel. If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. ! Upstream repository unknown source is not a standard remote. Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error. [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) [✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [!] Android Studio (not installed) [✓] Connected device (2 available) [✓] Network resources ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 3.1.5 Flutter SDK 3.13.9 investidormobile 2.10.2+399 dependencies: - adjust_sdk 4.36.0 [flutter meta] - amplify_auth_cognito 0.6.14 [amplify_auth_cognito_android amplify_auth_cognito_ios amplify_core aws_common collection flutter meta plugin_platform_interface] - amplify_flutter 0.6.14 [amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios aws_common collection flutter meta plugin_platform_interface] - amplify_storage_s3 0.6.14 [amplify_storage_s3_android amplify_storage_s3_ios amplify_core aws_common flutter meta plugin_platform_interface path_provider path] - animated_box_decoration 0.0.7 [flutter] - app_settings 4.1.8 [flutter] - aws_common 0.1.1 [async collection http meta stream_transform uuid] - aws_signature_v4 0.1.2 [async aws_common collection convert crypto http json_annotation meta path] - brasil_fields 1.14.1 [flutter intl] - camera 0.10.5+9 [camera_android camera_avfoundation camera_platform_interface camera_web flutter flutter_plugin_android_lifecycle] - carousel_slider 4.2.1 [flutter] - cloud_firestore 4.9.3 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - community_charts_flutter 1.0.2 [collection meta community_charts_common flutter] - country_code_picker 2.0.2 [flutter modal_bottom_sheet collection universal_platform] - cupertino_icons 1.0.6 - dbcrypt 2.0.0 - device_info_plus 9.1.1 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta win32 win32_registry] - document_detector 6.2.1 [flutter] - expansion_tile_group 1.1.9 [flutter] - extended_masked_text 2.3.1 [flutter] - external_path 1.0.3 [flutter] - facebook_app_events 0.19.0 [flutter] - firebase_analytics 10.5.1 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_app_check 0.2.0+1 [firebase_app_check_platform_interface firebase_app_check_web firebase_core firebase_core_platform_interface flutter] - firebase_auth 4.10.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 2.17.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_core_platform_interface 4.8.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_dynamic_links 5.3.7 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface] - firebase_messaging 14.6.9 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_remote_config 3.0.15 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine] - flutter_dotenv 5.1.0 [flutter] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math web] - flutter_markdown 0.6.18+3 [flutter markdown meta path] - http 0.13.6 [async http_parser meta] - image 4.1.4 [archive meta xml] - image_picker 0.8.9 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows] - in_app_review 2.0.4 [flutter in_app_review_platform_interface] - intl 0.18.1 [clock meta path] - jwt_decode 0.3.1 - local_auth 2.1.8 [flutter local_auth_android local_auth_ios local_auth_platform_interface local_auth_windows] - mixpanel_flutter 2.2.0 [flutter flutter_web_plugins js] - nanoid 1.0.0 - new_face_liveness 3.1.4 [flutter] - no_context_navigation 2.1.2 [flutter] - onesignal_flutter 3.5.1 [flutter] - open_file_safe 3.2.3 [flutter ffi] - page_transition 2.1.0 [flutter] - path_provider 2.1.2 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - permission_handler 10.4.5 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface] - pinput 2.3.0 [flutter smart_auth universal_platform] - provider 6.1.1 [collection flutter nested] - rxdart 0.27.7 - sentry_flutter 7.14.0 [flutter flutter_web_plugins sentry package_info_plus meta ffi] - share 2.0.4 [meta mime flutter] - shared_preferences 2.2.2 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - syncfusion_flutter_charts 21.2.10 [flutter intl vector_math syncfusion_flutter_core] - url_launcher 6.2.3 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - validators 3.0.0 - video_player 2.8.2 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - yaml 3.1.2 [collection source_span string_scanner] dev dependencies: - flutter_lints 2.0.3 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web] dependency overrides: - modal_bottom_sheet 3.0.0-pre [flutter] transitive dependencies: - _flutterfire_internals 1.3.7 [collection firebase_core firebase_core_platform_interface flutter meta] - amplify_auth_cognito_android 0.6.14 [flutter] - amplify_auth_cognito_ios 0.6.14 [amplify_core flutter] - amplify_core 0.6.14 [aws_common collection flutter intl json_annotation meta plugin_platform_interface uuid] - amplify_datastore_plugin_interface 0.6.14 [amplify_core collection flutter meta] - amplify_flutter_android 0.6.14 [flutter] - amplify_flutter_ios 0.6.14 [amplify_core flutter] - amplify_storage_s3_android 0.6.14 [flutter] - amplify_storage_s3_ios 0.6.14 [flutter] - archive 3.4.10 [crypto path pointycastle] - args 2.4.2 - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - camera_android 0.10.8+16 [camera_platform_interface flutter flutter_plugin_android_lifecycle stream_transform] - camera_avfoundation 0.9.13+10 [camera_platform_interface flutter stream_transform] - camera_platform_interface 2.7.2 [cross_file flutter plugin_platform_interface stream_transform] - camera_web 0.3.2+4 [camera_platform_interface flutter flutter_web_plugins stream_transform] - characters 1.3.0 - clock 1.1.1 - cloud_firestore_platform_interface 5.16.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.7.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - collection 1.17.2 - community_charts_common 1.0.2 [intl collection meta vector_math] - convert 3.1.1 [typed_data] - cross_file 0.3.3+7 [js meta] - crypto 3.0.3 [typed_data] - csslib 1.0.0 [source_span] - device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface] - fake_async 1.3.1 [clock collection] - ffi 2.1.0 - file 7.0.0 [meta path] - file_selector_linux 0.9.2+1 [cross_file file_selector_platform_interface flutter] - file_selector_macos 0.9.3+3 [cross_file file_selector_platform_interface flutter] - file_selector_platform_interface 2.6.2 [cross_file flutter http plugin_platform_interface] - file_selector_windows 0.9.3+1 [cross_file file_selector_platform_interface flutter] - firebase_analytics_platform_interface 3.7.1 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.5.5+1 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_app_check_platform_interface 0.1.0+1 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_app_check_web 0.1.0+1 [_flutterfire_internals firebase_app_check_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_auth_platform_interface 6.19.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.8.2 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta] - firebase_core_web 2.8.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_dynamic_links_platform_interface 0.2.6+7 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_platform_interface 4.5.8 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.5.8 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - firebase_remote_config_platform_interface 1.4.7 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_remote_config_web 1.4.7 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js] - flutter_plugin_android_lifecycle 2.0.17 [flutter] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web] - html 0.15.4 [csslib source_span] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image_picker_android 0.8.9+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 2.2.0 [flutter flutter_web_plugins image_picker_platform_interface mime] - image_picker_ios 0.8.9+1 [flutter image_picker_platform_interface] - image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_platform_interface 2.9.3 [cross_file flutter http plugin_platform_interface] - image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface] - in_app_review_platform_interface 2.0.5 [flutter url_launcher plugin_platform_interface platform] - js 0.6.7 [meta] - json_annotation 4.4.0 [meta] - lints 2.1.1 - local_auth_android 1.0.36 [flutter flutter_plugin_android_lifecycle intl local_auth_platform_interface] - local_auth_ios 1.1.6 [flutter intl local_auth_platform_interface] - local_auth_platform_interface 1.0.10 [flutter plugin_platform_interface] - local_auth_windows 1.0.10 [flutter local_auth_platform_interface] - markdown 7.2.1 [args meta] - matcher 0.12.16 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.5.0 [collection] - meta 1.9.1 - mime 1.0.4 - nested 1.0.0 [flutter] - package_info_plus 4.2.0 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface win32] - package_info_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - path 1.8.3 - path_provider_android 2.2.2 [flutter path_provider_platform_interface] - path_provider_foundation 2.3.2 [flutter path_provider_platform_interface] - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.2 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - permission_handler_android 10.3.6 [flutter permission_handler_platform_interface] - permission_handler_apple 9.1.4 [flutter permission_handler_platform_interface] - permission_handler_platform_interface 3.12.0 [flutter meta plugin_platform_interface] - permission_handler_windows 0.1.3 [flutter permission_handler_platform_interface] - petitparser 5.4.0 [meta] - platform 3.1.4 - plugin_platform_interface 2.1.8 [meta] - pointycastle 3.7.4 [collection convert js] - sentry 7.14.0 [http meta stack_trace uuid] - shared_preferences_android 2.2.1 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.3.5 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.3.2 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.3.2 [flutter plugin_platform_interface] - shared_preferences_web 2.2.1 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.3.2 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - sky_engine 0.0.99 - smart_auth 1.1.1 [flutter flutter_web_plugins] - source_span 1.10.0 [collection path term_glyph] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - stream_transform 2.1.0 - string_scanner 1.2.0 [source_span] - syncfusion_flutter_core 21.2.10 [vector_math flutter] - term_glyph 1.2.1 - test_api 0.6.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - typed_data 1.3.2 [collection] - universal_platform 1.0.0+1 - url_launcher_android 6.2.2 [flutter url_launcher_platform_interface] - url_launcher_ios 6.2.4 [flutter url_launcher_platform_interface] - url_launcher_linux 3.1.1 [flutter url_launcher_platform_interface] - url_launcher_macos 3.1.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.3.1 [flutter plugin_platform_interface] - url_launcher_web 2.2.0 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.1.1 [flutter url_launcher_platform_interface] - uuid 3.0.6 [crypto] - vector_math 2.1.4 - video_player_android 2.4.11 [flutter video_player_platform_interface] - video_player_avfoundation 2.5.2 [flutter video_player_platform_interface] - video_player_platform_interface 6.2.2 [flutter plugin_platform_interface] - video_player_web 2.1.3 [flutter flutter_web_plugins video_player_platform_interface] - web 0.1.4-beta - win32 5.1.1 [ffi] - win32_registry 1.1.2 [ffi win32] - xdg_directories 1.0.4 [meta path] - xml 6.3.0 [collection meta petitparser] ```

darshankawar commented 6 months ago

await FirebaseAuth.instance.signInAnonymously();

@icorradi-inco Does it work after removing this line ?

Also, try the plugin example and check if using it you get same behavior or not.

icorradi-inco commented 6 months ago

@darshankawar It's not working even after removing that line.

I also tried the plugin example that you suggested, and it didn't work either.

corradi in [example] (master) $ flutter run
Launching lib/main.dart on iPhone 15 Pro Max in debug mode...
Running Xcode build...
 └─Compiling, linking and signing...                        18.1s
Xcode build done.                                           37.3s
[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
Firebase App Check Debug Token: B08FBA7A-7924-41D7-99F8-BF18F75993B9
Syncing files to device iPhone 15 Pro Max...                        31ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on iPhone 15 Pro Max is available at: http://127.0.0.1:57255/Z-1ujhkpMMc=/
The Flutter DevTools debugger and profiler on iPhone 15 Pro Max is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:57255/Z-1ujhkpMMc=/
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [firebase_app_check/code-unsupported] The operation couldn’t be completed. The attestation provider DeviceCheckProvider is not supported on current platform and OS version.
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:322:18)
<asynchronous suspension>
#2      MethodChannelFirebaseAppCheck.getToken (package:firebase_app_check_platform_interface/src/method_channel/method_channel_firebase_app_check.dart:100:22)
<asynchronous suspension>
#3      _FirebaseAppCheck.build.<anonymous closure> (package:firebase_app_check_example/main.dart:127:17)
<asynchronous suspension>

I have also upgraded the Flutter version to run the plugin example:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.7, on macOS 14.0 23A344 darwin-arm64, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 2 categories.
danagbemava-nc commented 6 months ago

Hi @icorradi-inco, do you get this issue when you try to get the token in the plugin example app?

google-oss-bot commented 5 months ago

Hey @icorradi-inco. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

icorradi-inco commented 5 months ago

Hi @danagbemava-nc, exactly, both in my personal project and in the example, the same issue occurred.

darshankawar commented 5 months ago

Thanks for the update. We are unable to replicate the behavior using the plugin example running on iOS simulator, wherein, we the debug token generated without the reported exception.

2024-02-16 15:29:18.813073+0530 Runner[50916:273510] <Warning> [AppCheckCore][I-GAC004001] App Check debug token: '712ECE6D-B1A7-4D2D-B531-ECC87EB0BC94'.
2024-02-16 15:29:18.813475+0530 Runner[50916:273510] Firebase App Check Debug Token: 712ECE6D-B1A7-4D2D-B531-ECC87EB0BC94
2024-02-16 15:29:19.332399+0530 Runner[50916:275453]

Based on the report, I'll label this for team's input / attention.

nialljawad96 commented 3 months ago

Getting this exact same error too. Using AppleProvider.debug yet it's talking about DeviceCheckProvider...... Did you manage to solve this @icorradi-inco

russellwheatley commented 3 months ago

@nialljawad96 I've just tested this. It works. To clear up any confusion, you should be copy/pasting the Debug Token printed in your terminal and pasting it into the Firebase console as a debug token. This will allow you the underlying API to exchange debug token for a real one on the server (i.e. when you call getToken()).

nialljawad96 commented 3 months ago

@russellwheatley I've been doing that for the past few years. I solved this by inputting this in my AppDelegate.swift:

class YourAppCheckProviderFactory: NSObject, AppCheckProviderFactory {
  func createProvider(with app: FirebaseApp) -> AppCheckProvider? {
    if #available(iOS 14.0, *) {
      return AppAttestProvider(app: app)
    } else {
      return DeviceCheckProvider(app: app)
    }
  }
}

let providerFactory: AppCheckProviderFactory = AppCheckDebugProviderFactory()
AppCheck.setAppCheckProviderFactory(providerFactory)

This problem appears to be from App Check defaulting to using DeviceCheckProvider when we have AppleProvider.debug selected - unrelated to putting the token in the console. The token is outputted correctly and is the correct one, because I used the same token before and after adding the above code, and it worked after adding it.

russellwheatley commented 3 months ago

We set DeviceCheck to default as it is on firebase-ios-sdk, and when you call:

  await FirebaseAppCheck.instance.activate(
    appleProvider: AppleProvider.debug,
  );

it will replace DeviceCheck with Debug provider using facade implementation. Please ensure you call activate() right after you initialise your Firebase app before any other Firebase API call. i.e.

await Firebase.initializeApp();
await FirebaseAppCheck.instance.activate(
    appleProvider: AppleProvider.debug,
  );
nialljawad96 commented 3 months ago

@russellwheatley I'm doing that unfortunately. Odd one. Seems like something is either preventing DeviceCheck being replaced, or it's being replaced then reset later. Don't know if the AppDelegate.swift code provides any clues - hopefully it does!

icorradi-inco commented 3 months ago

Did you manage to solve this @icorradi-inco

Unfortunately, no, @nialljawad96. We have stopped using appCheck for now.

aryan1107 commented 3 months ago

@darshankawar Does app check supports macos 10.15 or 11? I get similar error for few users. I can't find minimum macos version anywhere in documentation.

jjgriff93 commented 2 months ago

Just thought I'd add to this thread as I hit this in my Capacitor app. It seems to happen when you can Firebase.configure() before you initialise the app check provider, which makes it default to DeviceCheck no matter what provider you set up. If you call configure() afterwards it should resolve the issue

google-oss-bot commented 2 months ago

Hey @icorradi-inco. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 1 month ago

Since there haven't been any recent updates here, I am going to close this issue.

@icorradi-inco if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

alistair-riskmemo commented 1 month ago

I've been having this issue as well. I implemented @nialljawad96 solution, but for me, it wouldn't use the debug provider either. I resolved this with the following:

import UIKit
import Flutter
import GoogleMaps
import FirebaseCore
import FirebaseAppCheck

@main
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    // Variable declaration
    let providerFactory: AppCheckProviderFactory

    // Check if the app is running in debug mode
    #if DEBUG
    providerFactory = AppCheckDebugProviderFactory()
    #else
    providerFactory = YourAppCheckProviderFactory()
    #endif

    // Set the chosen AppCheckProviderFactory before configuring Firebase
    AppCheck.setAppCheckProviderFactory(providerFactory)

    FirebaseApp.configure()
    GMSServices.provideAPIKey("xxxx")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

// Define the YourAppCheckProviderFactory outside of your AppDelegate class
class YourAppCheckProviderFactory: NSObject, AppCheckProviderFactory {
  func createProvider(with app: FirebaseApp) -> AppCheckProvider? {
    if #available(iOS 14.0, *) {
      return AppAttestProvider(app: app)
    } else {
      return DeviceCheckProvider(app: app)
    }
  }
}

I also had to edit the Swift Compiler - Custom Flags in xcode for #if DEBUG to work.