Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why my app is showing App with name __FIRAPP_DEFAULT does not exist

I am developing flutter ios app with frebase. I want to login to the app using sms authentication. When i am running the app it is fetching details from db. But it is showing the error in app launching time. The error is - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.

In the xcode i have enabled the enabled "Push Notifications" and "Remote Notifications" for removing captcha in OTP verification. But if i disabled "Push Notifications" and "Remote Notifications" it will show captcha. And after verifying captcha it send SMS. - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist. in application open. i given below main.dart file

   final FirebaseApp app = await FirebaseApp.configure(
      name: myApp,
      options: const FirebaseOptions(
        googleAppID: '1:57979xxxxx:ios:c9d1031xx',
        gcmSenderID: '58989xxxxx6',
        apiKey: 'AIzaSyANwavsssasxxxxxxxxxxxKBNF7I',
        projectID: 'myApp',
      ),
   );

The SMS verification code is

  await firebaseAuth.verifyPhoneNumber(
      phoneNumber: "+91"+phoneNumber,
      timeout: Duration(seconds: timeOut),
      codeAutoRetrievalTimeout: autoRetrieve,
      codeSent: smsCodeSent,
      verificationCompleted: verifiedSuccess,
      verificationFailed: veriFailed);

    final PhoneVerificationFailed veriFailed = (AuthException exception) {
    print("ERROR");
    print('${exception.message}');
    throw new Exception(exception);
  };

When i enabled "Push Notifications" and "Remote Notifications"

It will show the error in "veriFailed" function . The error is Invalid Token and

PlatformException(ERROR_MISSING_VERIFICATION_ID, The phone auth credential was created with an empty verification ID., null)

The info.plist is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>APS Environment</key>
    <string>production</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>My App</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>My App</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb3xxxxxxxxx</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps.xxxxxxxxxxxxxxx</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.myapp.app</string>
            </array>
        </dict>
    </array>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
    <key>FacebookAppID</key>
    <string>334xxxxxxxx</string>
    <key>FacebookDisplayName</key>
    <string>My App</string>
    <key>FirebaseAppDelegateProxyEnabled</key>
    <false/>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>This application requires location services to work</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>This application requires location services to work</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>This application requires location services to work</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>io.flutter.embedded_views_preview</key>
    <true/>
</dict>
</plist>

My pubspec.yaml is

firebase_core: ^0.4.0+8
firebase_auth: ^0.11.1+11
cloud_firestore: ^0.12.7
firebase_messaging: ^5.1.2

I don't know how to solve the issue please help me.

like image 366
Joe Avatar asked Jul 30 '19 09:07

Joe


2 Answers

Swap lines in AppDelegate.swift to FirebaseApp is called before plugin.

FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
like image 88
Joe Bobson Avatar answered Nov 13 '22 20:11

Joe Bobson


I solve the by changing auth plugin to

firebase_auth:
  git:
    url: https://github.com/collinjackson/plugins.git
    ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
    path: packages/firebase_auth

After adding the plugin the problem solved. The plugin firebase_auth: ^0.11.1+11 is making the issues

like image 35
Joe Avatar answered Nov 13 '22 20:11

Joe