iOS 12 Projekt in XCode11

You are here:
← All Topics

In XCode11 können mit Hilfe der Wizards nur noch iOS13 Projekte erstellt werden. Der generierte Sourcecode ist auf iOS12 nicht läuffähig. Um iOS13 Projekte dennoch auf iOS12 zum Laufen zu bringen sind einige Änderungen erforderlich. Als erster Schritt muss das Target auf iOS12 gesetzt werden.

Als nächstes fügen wir der SceneDelegate Klasse die @available(iOS 13.0, *) Annotation hinzu und deklarieren danach die Variable window vom Typ UIWindow

@available(iOS 13.0, *)
    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

Jetzt müssen im AppDelegate die Funktionen configurationForConnecting und didDiscardSceneSessions mit @available(iOS 13.0, *) annotiert werden.

@available(iOS 13.0, *)
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
@available(iOS 13.0, *)
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}

Schlagwörter: