HomeiOS Developmentios - methodology shouldn't be known as on the principle thread as...

ios – methodology shouldn’t be known as on the principle thread as it might result in UI unresponsiveness


I get the next error on my @principal thread “This methodology shouldn’t be known as on the principle thread as it might result in UI unresponsiveness.”

The overwhelming majority of the time the UI responsiveness is okay nevertheless it does typically turn out to be unresponsive. I’ve seen it usually turns into unresponsive when a hyperlink that navigates out of the app is tapped when Hyperlink() is used.

I feel that it’s attributable to the Google Admob code that was added.

Right here is my code:

import SwiftUI
import BackgroundTasks
import GoogleMobileAds
import UserNotifications


@principal
struct Test_ProjectApp: App {
    
    init(){
        GADMobileAds.sharedInstance().begin(completionHandler: nil)
                
        let isNotificationsEnabled = UserDefaults.customary.bool(forKey: "isNotificationsEnabled")
        if isNotificationsEnabled {
            UNUserNotificationCenter.present().requestAuthorization(choices: [.alert, .sound, .badge]) { granted, error in
                if granted {
                    print("Notifications permission granted.")
                    exampleNotification()
                } else {
                    print("Notifications permission denied as a result of: (error?.localizedDescription ?? "unknown error").")
                }
            }
        }
    }
    
    
    var physique: some Scene {
        WindowGroup {
            ContentView()
                .onOpenURL(carry out: { url in
                    
                })
        }
    }
}

Is that this an okay place to name the tactic or ought to it’s carried out in a different way?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments