NativeScript / NativeScript/firebase
Phone authentication hangs on iOS with @nativescript/firebase 5.0.2
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 62
- 派生
- 53
- 平均合并
- 8 天 4 小时
- 30 天内合并 PR
- 2
描述
I have upgraded my app to the latest version of everything, namely NativeScript 8.9.2, @nativescript/firebase 5.0.2, macOS Sequoia 16.6.1, Xcode 16.4, etc. I can log in on Android devices and simulators (with test numbers) successfully, as I had before the upgrade. On iOS, however, the login hangs after entering the verification code from the SMS message. The Firebase UI completes, in that my login screen is displayed, but control is never returned. This is the code I use to initiate the login:
let idp = await firebase().ui().show({ providers: [new PhoneProvider()] });
In addition to the hang, I also receive the two silent notifications shown below.
app-root.js: handleMsg: message: {
"foreground": true,
"data": {
"com.google.firebase.auth": {
"warning": "This fake notification should be forwarded to Firebase Auth."
}
}
}
app-root.js:61 app-root.js: handleMsg: message: {
"data": {
"com.google.firebase.auth": "{\"receipt\":\"AEFDNu9LxA12I0A5Vch7JoTI8XiANEA-viqkiPhRykmcra6aVSCmjVZa5il-Yt4JUh3nbgRzhULnxdKSOEpMQUpcjWr72qkpx3p-ssSSemqDD8l33JdZqN-20Rl5RzU83A\",\"secret\":\"i9pLJ5Ol3WBB17Ol\"}"
},
"notification": {
"apple": {}
},
"contentAvailable": 1,
"foreground": true,
"messageId": "1757287521614594"
}
I found this information in the Firebase docs:
When you call verifyPhoneNumber(_:uiDelegate:completion:), Firebase sends a silent push notification to your app, or issues a reCAPTCHA challenge to the user. After your app receives the notification or the user completes the reCAPTCHA challenge, Firebase sends an SMS message containing an authentication code to the specified phone number and passes a verification ID to your completion function. You will need both the verification code and the verification ID to sign in the user.
I'm guessing that the secret property is the verification ID, but if so, I don't see how I can couple that with the verification code since they are on different threads.
Is anyone successfully using phone authentication with @nativescript/firebase 5.0.2?
I've included my package.json, build.xcconfig and Podfile contents below.
package.json
{
"name": "festivelo",
"main": "app/app.js",
"version": "1.0.0",
"private": true,
"dependencies": {
"@bradmartin/nativescript-urlhandler": "^2.0.1",
"@master.technology/permissions": "^2.0.1",
"@nativescript-community/ui-collectionview": "^6.0.4",
"@nativescript-community/ui-material-bottom-navigation": "^7.2.71",
"@nativescript/appversion": "^2.0.0",
"@nativescript/contacts": "^3.0.0",
"@nativescript/core": "~8.9.7",
"@nativescript/email": "^2.1.0",
"@nativescript/firebase-auth": "^5.0.2",
"@nativescript/firebase-core": "^5.0.2",
"@nativescript/firebase-database": "^5.0.2",
"@nativescript/firebase-messaging": "^5.0.2",
"@nativescript/firebase-ui": "5.0.2",
"@nativescript/geolocation": "^9.0.0",
"@nativescript/google-maps": "1.7.2",
"@nativescript/iqkeyboardmanager": "^2.1.2",
"@nativescript/pdf": "^2.0.0",
"@nativescript/theme": "^3.1.0",
"@triniwiz/nativescript-toasty": "^4.1.3",
"@wuilmerj24/store-update": "^1.0.7",
"assert": "^2.1.0",
"base-64": "^1.0.0",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"https-browserify": "^1.0.0",
"nativescript": "^8.9.3",
"nativescript-app-tour": "^4.0.0",
"nativescript-bitmap-factory": "^1.8.1",
"nativescript-clipboard": "^2.1.1",
"nativescript-danem-google-maps-utils": "^1.0.18",
"nativescript-drop-down": "6.0.2",
"nativescript-phone": "^3.0.3",
"nativescript-screenshot": "^0.0.2",
"nativescript-sqlite": "^2.8.6",
"nativescript-ui-listview": "^15.2.3",
"nativescript-ui-sidedrawer": "^15.2.3",
"os-browserify": "^0.3.0",
"patch-package": "^8.0.0",
"path": "^0.12.7",
"path-browserify": "^1.0.1",
"querystring-es3": "^0.2.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"tty-browserify": "^0.0.1",
"url": "^0.11.3"
},
"devDependencies": {
"@nativescript/android": "8.9.1",
"@nativescript/ios": "8.9.2",
"@nativescript/webpack": "^5.0.18",
"util": "^0.12.5"
},
"scripts": {
"postinstall": "patch-package"
}
}
build.xcconfig
// You can add custom settings here
// for example you can uncomment the following line to force distribution code signing
// CODE_SIGN_IDENTITY = iPhone Distribution
// To build for device with XCode you need to specify your development team.
DEVELOPMENT_TEAM = xxxxxxxxxx
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
TARGETED_DEVICE_FAMILY = 1;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
CODE_SIGN_ENTITLEMENTS = festivelo/festivelo.entitlements
// See https://stackoverflow.com/questions/66105038/referenceerror-metadata-for-googlemaps-gmsgeometrydistance-found-but-symbol-n
STRIPFLAGS=$(inherited) -s ${PROJECT_DIR}/../../App_Resources/iOS/exportedSymbols.txt
EXPORTED_SYMBOLS_FILE = ${PROJECT_DIR}/../../App_Resources/iOS/exportedSymbols.txt
// See https://github.com/msywensky/nativescript-phone/issues/51
OTHER_LDFLAGS = $(inherited) -framework MessageUI
// See https://github.com/NativeScript/NativeScript/issues/8860
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))
Podfile
platform :ios, '15.0'
post_install do |installer|
installer.pods_project.targets.each do |target|
puts "Pods target name: " + target.name
# bypass xcode 16 error
# see https://stackoverflow.com/questions/78608693/boringssl-grpc-unsupported-option-g-for-target-arm64-apple-ios15-0
if target.name == 'BoringSSL-GRPC'
target.source_build_phase.files.each do |file|
if file.settings && file.settings['COMPILER_FLAGS']
flags = file.settings['COMPILER_FLAGS'].split
flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
file.settings['COMPILER_FLAGS'] = flags.join(' ')
end
end
end
target.build_configurations.each do |config|
# suppress warnings
# see https://discord.com/channels/603595811204366337/828973466534936637/1192028592255799317
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = 'YES'
# see https://github.com/NativeScript/NativeScript/issues/10034
if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
config.build_settings['DEVELOPMENT_TEAM'] = 'C424ZH53NJ'
end
# see https://github.com/NativeScript/NativeScript/issues/8860
# see https://www.jessesquires.com/blog/2020/07/20/xcode-12-drops-support-for-ios-8-fix-for-cocoapods/
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
# see https://stackoverflow.com/questions/63607158/xcode-building-for-ios-simulator-but-linking-in-an-object-file-built-for-ios-f/63714000#63714000
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
# see https://github.com/CocoaPods/CocoaPods/issues/12012
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
if target.name == 'Realm'
create_symlink_phase = target.shell_script_build_phases.find { |x| x.name == 'Create Symlinks to Header Folders' }
create_symlink_phase.always_out_of_date = "1"
puts "target.name = Realm found"
end
# See https://stackoverflow.com/questions/61980618/getting-a-new-build-error-for-ios-nativescript
if ['Toast-Swift'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.3'
end
end
if ['FirebaseCoreInternal'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.3'
end
end
if ['FirebaseStorage'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.3'
end
end
# Hack to see if this works with Firebase 5.0.3
if ['FirebaseAuth'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.3'
end
end
if target.name.start_with? "GoogleDataTransport"
target.build_configurations.each do |config|
config.build_settings['CLANG_WARN_STRICT_PROTOTYPES'] = 'NO'
end
end
end
end
end
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 app-root.js 的消息处理和 @nativescript/firebase-ui 的 phone-auth 入口点开始;结合所引用的 Firebase iOS phone-auth 流程,检查 package.json、build.xcconfig 和 Podfile。在提供的版本上于 iOS 中重现,并验证完成 SMS 验证后会从 show() 返回,且用户保持登录状态,不会出现报告中的卡死问题。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- firebase, ios, typescript
- 领域
- authentication, mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100