[英]Firebase app check not working with iOS 16
It looks like for my app the firebase app check is not working with iOS16.对于我的应用程序,firebase 应用程序检查似乎不适用于 iOS16。 I have configured the app attest and its been working for more than a year, it's still working with older iOS versions but not iOS 16.
我已经配置了应用程序证明,它已经工作了一年多,它仍然可以使用旧的 iOS 版本,但不能使用 iOS 16。
This is the code that I initialise app check这是我初始化应用程序检查的代码
import SwiftUI
import Firebase
import FirebaseAppCheck
@main
struct appointmeparterAppApp: App {
@Environment(\.scenePhase) var scenePhase
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
init() {
let providerFactory = YourAppCheckProviderFactory()
AppCheck.setAppCheckProviderFactory(providerFactory)
FirebaseApp.configure()
}
}
class YourAppCheckProviderFactory: NSObject, AppCheckProviderFactory {
func createProvider(with app: FirebaseApp) -> AppCheckProvider? {
return AppAttestProvider(app: app)
}
}
I am sure the problem is app check because if it's not enforced everything works as expected, and if I enforce it then i get permissions error.我确定问题出在应用程序检查上,因为如果它没有强制执行,一切都会按预期工作,如果我强制执行它,则会出现权限错误。 (this happens only on iOS 16)
(这仅发生在 iOS 16 上)
import SwiftUI
import Firebase
import FirebaseCore
import FirebaseAppCheck
class AppDelegate: NSObject, UIApplicationDelegate {
let providerFactory = ACFTAppCheckProviderFactory()
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
AppCheck.setAppCheckProviderFactory(providerFactory)
FirebaseApp.configure()
return true
}
}
@main
struct ACFTApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
class ACFTAppCheckProviderFactory: NSObject, AppCheckProviderFactory {
func createProvider(with app: FirebaseApp) -> AppCheckProvider? {
return AppAttestProvider(app: app)
}
}
Set the App attest env.
设置 App 认证环境。 to production.
生产。 Ensure you add App Attest capability to your app target.
确保将 App Attest 功能添加到您的应用程序目标。 Remove the -FIRDebugEnabled in your app scheme/run/arguments.
在您的应用方案/运行/参数中删除 -FIRDebugEnabled。 Possibly ensure you add the debug token to your registered apps/manage tokens on FB.
可能确保您将调试令牌添加到您在 FB 上注册的应用程序/管理令牌。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.