Joe*_*Joe 6 ios firebase firebase-authentication flutter
我正在使用 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 文件
final FirebaseApp app = await FirebaseApp.configure(
name: myApp,
options: const FirebaseOptions(
googleAppID: '1:57979xxxxx:ios:c9d1031xx',
gcmSenderID: '58989xxxxx6',
apiKey: 'AIzaSyANwavsssasxxxxxxxxxxxKBNF7I',
projectID: 'myApp',
),
);
Run Code Online (Sandbox Code Playgroud)
短信验证码是
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);
};
Run Code Online (Sandbox Code Playgroud)
当我启用“推送通知”和“远程通知”时
它将在“veriFailed”函数中显示错误。错误是
Invalid Token和
PlatformException(ERROR_MISSING_VERIFICATION_ID, The phone auth credential was created with an empty verification ID., null)
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
我的pubspec.yaml是
firebase_core: ^0.4.0+8
firebase_auth: ^0.11.1+11
cloud_firestore: ^0.12.7
firebase_messaging: ^5.1.2
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决这个问题,请帮助我。
在插件之前调用 AppDelegate.swift 到 FirebaseApp 的交换行。
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
Run Code Online (Sandbox Code Playgroud)
我通过将auth插件更改为来解决
firebase_auth:
git:
url: https://github.com/collinjackson/plugins.git
ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
path: packages/firebase_auth
Run Code Online (Sandbox Code Playgroud)
添加插件后问题解决。该插件firebase_auth: ^0.11.1+11正在造成问题
| 归档时间: |
|
| 查看次数: |
6221 次 |
| 最近记录: |