XCode 11 with IOS 12 issue

So I'm developing my first application on XCode 11. The app installs and runs properly on my ios 13 devices, but when I tried to install it an ios 12 device it installs but opens up with a Dark Screen. I want to be able to develop an app for ios 12/11 + using XCode 11.

Replies

New iOS projects in Xcode 11 have their deployment target set to iOS 13. The deployment target is the earliest version of iOS that can run the app. A new Xcode 11 iOS project will not run on earlier iOS versions unless you change the deployment target to an earlier version of iOS.


Select your project from the project navigator to change the deployment target. If you need additional information on how to change the deployment target, read the article at the following URL:


swiftdevjournal.com/supporting-older-versions-of-ios-and-macos/

I thought it would just refuse to install on an unsupported target rather than installing and displaying a black screen.

It appears to be more complicated than lowering your deploy target to iOS 12. When a new project is created in Xcode, a SceneDelegate.swift is added to your project, and the AppDelegate.swift looks nothing like it ought to for support iOS 12 and below.

Further, there is now an Application Scene Manifest in your info.plist which must be removed else you'll get a message like: "[SceneConfiguration] Info.plist configuration "(no name)" for UIWindowSceneSessionRoleApplication contained UISceneDelegateClassName key, but could not load class with name ..."


So steps to getting to an iOS 12/13 app:

1) Change deployment target to iOS 12.

2) Replace the AppDelegate's methods with what they ought to have for iOS 12 development. Also add this:

var window: UIWindow?

3) Remove SceneDelegate.

4) Remove Application Scene Manifest in your info.plist.


Hopefully Apple will ask for the deployment target when creating a new project, prior to shipping Xcode 11 GM. It seems like this is a continual struggle for Apple... creating appropriate new project templates in Xcode. (Remember when the new view controller method signatures were all wrong during Swift 2 to 3 jump?). What small percentage of devs creating new apps destined for the App Store in the next year will choose to restrict them to iOS 13 only?

I bet they did it on purpose so that people by default will develop for iOS 13.

add bellow line in your appdelegate method and your blank screen's problem will be resolved.

    var window: UIWindow?

Since Xcode assume your project will be iOS 13, it created many things that are not compatible with iOS 12, e.g. SceneDelegate.swift.
So these are files you need to change to make it support old version of iOS.

SceneDelegate.swift
Add availability attributes to this whole class since this UIWindowSceneDelegate is for iOS 13 or greater.
@available(iOS 13.0, *)
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
...
}

AppDelegate.swift
In AppDelegate.swift there are two new UIApplicationDelegate methods that we need to Add @available(iOS 13.0, *)

// MARK: UISceneSession Lifecycle
@available(iOS 13.0, *)
func application( application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
...
}

@available(iOS 13.0, *)
func application(
application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
...
}

And the last step is to UIWindow variable back to AppDelegateclass AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}


Available in: sarun.com
I designed an iPhone app using Xcode 12.0 and when I simulated it gave me errors on the Target with red files. I updated Catalina with a new version and the problem got even worst. I created a new project and Xcode 12.1 froze and I could not open it at all.