Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase app check not working with iOS 16

It looks like for my app the firebase app check is not working with 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.

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)

like image 864
Onix Avatar asked Oct 22 '25 18:10

Onix


1 Answers

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

enter image description here

Set the App attest env. to production. Ensure you add App Attest capability to your app target. Remove the -FIRDebugEnabled in your app scheme/run/arguments. Possibly ensure you add the debug token to your registered apps/manage tokens on FB.

like image 168
cbear84 Avatar answered Oct 24 '25 09:10

cbear84



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!