为什么我的应用程序显示名称为__FIRAPP_DEFAULT的应用程序不存在

时间:2019-07-30 09:06:38

标签: ios firebase flutter firebase-authentication

我正在使用frebase开发Flutter ios应用程序。我想使用短信身份验证登录到应用程序。当我运行该应用程序时,它正在从数据库中获取详细信息。但是它显示了应用启动时间中的错误。 错误是 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.

在xcode中,我启用了启用的“推送通知”和“远程通知”以删除OTP验证中的验证码。 但是,如果我禁用了“推送通知”和“远程通知”,它将显示验证码。并在验证验证码后发送短信。 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.在应用程序打开中。 我在main.dart文件下面给出

最终FirebaseApp应用=等待FirebaseApp.configure(       名称:myApp,       选项:const FirebaseOptions(         googleAppID:'1:57979xxxxx:ios:c9d1031xx',         gcmSenderID:'58989xxxxx6',         apiKey:“ AIzaSyANwavsssasxxxxxxxxxxxKBNF7I”,         projectID:“ myApp”,       ),    );

SMS验证码是

  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);
  };

当我启用“推送通知”和“远程通知”

它将在“ veriFailed”功能中显示错误。错误是 Invalid Token

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

info.plist是

<?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>

我的pubspec.yaml

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

我不知道如何解决该问题,请帮助我。

2 个答案:

答案 0 :(得分:7)

在插件之前调用AppDelegate.swift中的行交换到FirebaseApp。

FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)

答案 1 :(得分:0)

我通过将errors='coerce'插件更改为

来解决
auth

添加插件后,问题解决了。插件firebase_auth: git: url: https://github.com/collinjackson/plugins.git ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de path: packages/firebase_auth 引起了问题