Flutter (ios) Your app is missing support for the following URL schemes

Published Jul 8, 2023

iosiphonefluttergooglefirebase

Hola a todos, como bien saben nuestra apliación de EduQuest esta hecha en Flutter y la autenticación de usuarios es con una cuenta de Gmail.

La aplicación en android funcionó sin mayor problema, pero cuando intentamos compilarla en Xcode aparecio este error:


2023-09-10 09:28:56.460388-0600 Runner[9754:519625] Metal API Validation Enabled
2023-09-10 09:28:56.611772-0600 Runner[9754:519625] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(35)] Using the Impeller rendering backend.
2023-09-10 09:28:56.658153-0600 Runner[9754:519862] 10.9.0 - [FirebaseCore][I-COR000005] No app has been configured yet.
2023-09-10 09:28:56.665745-0600 Runner[9754:519905] flutter: The Dart VM service is listening on http://127.0.0.1:77777/HLBvsBaEZOs=/
2023-09-10 09:28:56.669226-0600 Runner[9754:519862] 10.9.0 - [FirebaseMessaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2023-09-10 09:28:56.679282-0600 Runner[9754:519625] no valid “aps-environment” entitlement string found for application
2023-09-10 09:28:56.689433-0600 Runner[9754:519912] 10.9.0 - [FirebaseMessaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: no valid “aps-environment” entitlement string found for application
2023-09-10 09:28:56.924902-0600 Runner[9754:519885] flutter: Permission granted: AuthorizationStatus.authorized
2023-09-10 09:28:57.095571-0600 Runner[9754:519912] [connection] nw_connection_copy_connected_local_endpoint_block_invoke [C3] Client called nw_connection_copy_connected_local_endpoint on unconnected nw_connection
2023-09-10 09:28:57.095616-0600 Runner[9754:519912] [connection] nw_connection_copy_connected_remote_endpoint_block_invoke [C3] Client called nw_connection_copy_connected_remote_endpoint on unconnected nw_connection
2023-09-10 09:28:57.095665-0600 Runner[9754:519912] [connection] nw_connection_copy_protocol_metadata_internal_block_invoke [C3] Client called nw_connection_copy_protocol_metadata_internal on unconnected nw_connection
2023-09-10 09:28:57.464592-0600 Runner[9754:519885] flutter: Registration
2023-09-10 09:29:00.012017-0600 Runner[9754:519885] [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(google_sign_in, Your app is missing support for the following URL schemes: com.googleusercontent.apps.59988387237-sd34asd87fas98d7fas87df6, NSInvalidArgumentException, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:510:43)
<asynchronous suspension>
#3      GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:278:30)
<asynchronous suspension>
#4      GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart:431:5)
<asynchronous suspension>
2023-09-10 09:29:00.016432-0600 Runner[9754:519625] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Your app is missing support for the following URL schemes: com.googleusercontent.apps.59988387237-t05cvmqasd87fas98d7fas87df6'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000180437330 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180051274 objc_exception_throw + 56
	2   CoreFoundation                      0x0000000180437240 -[NSException initWithCoder:] + 0
	3   GoogleSignIn                        0x0000000102c6bc68 -[GIDSignIn signInWithOptions:] + 372
	4   GoogleSignIn                        0x0000000102c6a8b4 -[GIDSignIn signInWithConfiguration:presentingViewController:hint:additionalScopes:callback:] + 228
	5   Runner                              0x000000010241062c -[FLTGoogleSignInPlugin handleMethodCall:result:] + 1800
	6   Flutter                             0x00000001074b5aa8 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 172
	7   Flutter                             0x0000000106aa7a40 ___ZN7flutter25PlatformMessageHandlerIos21HandlePlatformMessageENSt21_LIBCPP_ABI_NAMESPACE10unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE_block_invoke + 108
	8   libdispatch.dylib                   0x000000010306c528 _dispatch_call_block_and_release + 24
	9   libdispatch.dylib                   0x000000010306dd50 _dispatch_client_callout + 16
	10  libdispatch.dylib                   0x000000010307e808 _dispatch_main_queue_drain + 1316
	11  libdispatch.dylib                   0x000000010307e2d4 _dispatch_main_queue_callback_4CF + 40
	12  CoreFoundation                      0x000000018039a784 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
	13  CoreFoundation                      0x0000000180394de4 __CFRunLoopRun + 1912
	14  CoreFoundation                      0x0000000180394254 CFRunLoopRunSpecific + 584
	15  GraphicsServices                    0x0000000188eb7c9c GSEventRunModal + 160
	16  UIKitCore                           0x000000010aa46ff0 -[UIApplication _run] + 868
	17  UIKitCore                           0x000000010aa4af3c UIApplicationMain + 124
	18  Runner                              0x00000001023eae08 main + 64
	19  dyld                                0x00000001024a9514 start_sim + 20
	20  ???                                 0x000000010258df28 0x0 + 4334346024
	21  ???                                 0xa54a800000000000 0x0 + 11910472902023053312
)
libc++abi: terminating due to uncaught exception of type NSException

Mi recomendación cuando tenemos errores así es leerlos un par de veces linea por linea, esto ayuda a tener una mejor idea de cual puede ser el problema y realizar una mejor busqueda en internet o tener una mejor platica con ChatGPT y solucionar el problema rápido y sin tanta cosa XDDD.

Este error literalmente nos dice como solucionarlo. y la respuesta esta aquí.

PlatformException(google_sign_in, Your app is missing support for the following URL schemes: com.googleusercontent.apps.59988387237-sd34asd87fas98d7fas87df6, NSInvalidArgumentException, null)

Esto se arregla super fácil, lo pueden hacer desde vi, vim, nvim, sublimetext, notepad, notepad++ y pues VSCode XDDD.

Dentro de nuestra app Flutter nos vamos a la carpeta ios/Runner y abrimos el archivo llamado Info.plist.

Este es un archivo XML, entonces, debemos buscar el primer tag <dict> y agregamos el siguiente código:


<key>CFBundleURLTypes</key>
<array>
 <dict>

        <key>CFBundleURLSchemes</key>
        <array>
            <string>com.googleusercontent.apps.59988387237-sd34asd87fas98d7fas87df6</string>
        </array>
    </dict>
</array>

El valor se obtiene del mensaje de error, entonces solo debes sustituirlo por el que se muestra en tu consola.

y listo, eso es todo, espero hayas podido solucionar el error.

Caso contrario, les dejo el discord de la comunidad, tenemos un canal de ayuda.


Discord

Elprogramadorgt - Blog © 2024