I used verify Phone Number by firebase_auth in flutter and I have this exception in iOS devices:
flutter: -[__NSCFString objectForKeyedSubscript:]: unrecognized selector sent to instance 0x600001755880
Flutter code:
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: widget.phoneNumber,
verificationCompleted: (PhoneAuthCredential credential)async {
p ('verificationCompleted*****************************************');
},
verificationFailed: (FirebaseAuthException e) {
p ('verificationFailed*****************************************');
p (e.message);
},
codeSent: (String verificationId, int? resendToken)async {
p ('codeSent*****************************************');
},
codeAutoRetrievalTimeout: (String verificationId) {
p ('codeAutoRetrievalTimeout*****************************************');
},
);
Firebase Packages (The latest versions):
firebase_core: ^2.31.1
firebase_messaging: ^14.9.3
firebase_auth: ^4.19.6
cloud_firestore: ^4.17.4
flutter_local_notifications: ^17.1.2
platform :ios, ‘13.0’
AppDelegate.swift
import UIKit
import Flutter
import FirebaseCore
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
My Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.5 23F79 darwin-arm64, locale
en-IQ)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.89.1)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!
I have updated all Firebase packages and still have this exception..
Are there any tips or solutions to this exception?
New contributor
HAMZA Hg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.