Tuesday, April 30, 2024
HomeiOS Developmentios - App migrated from SwiftUI to UIKit doesn't name any SceneDelegate...

ios – App migrated from SwiftUI to UIKit doesn’t name any SceneDelegate strategies, reveals clean display


Background:

The scenario described is similar to these highlighted within the following questions on SO and Apple Developer boards.

Sadly, after attempting the steered options, in addition to hours spent on attempting a permutation of different options, none has labored apart from utilizing a personal stage API.

Full context:

A SwiftUI app was dealt with to me to be reworked as a UIKit app. The migration concerned, in short, updating the Data.plist to make use of the UIApplicationSceneManifest, including a SceneDelegate, and including the @foremost to the AppDelegate file.

Challenge: for iPhone units that had the prior app with the SwiftUI arch put in, putting in the up to date model of the UIKit app would present a black display.

Additional investigations reveals that:

  • the SceneDelegate strategies are by no means referred to as
  • utility(_ utility: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, choices: UIScene.ConnectionOptions) -> UISceneConfiguration is rarely referred to as from AppDelegate
  • this challenge wouldn’t happen if the person deleted the prior model app, and put in the brand new UIKIt app
  • this can be because of the cached SceneDelegate periods, which was launched in iOS 13

Nonetheless, it’s not potential to ask the customers to delete the prior SwiftUI app and obtain the brand new app.

“Unhealthy” answer:

The one factor that has labored thus far is to insert the next

utility.openSessions.forEach { session in
            utility.carry out(Selector(("_removeSessionFromSessionSet:")), with: session)
        }

in didFinishLaunchingWithOptions in AppDelegate. Nonetheless, as a result of it is a private-level API, I’m unable to make use of it within the stay app.

For context, the non-public API answer was discovered right here from a write-up on testing.

Query

Are there different methods to carry out the session elimination much like what the non-public API did, which can take away the cached SceneDelegate periods? I’ve additionally tried UIApplication.shared.requestSceneSessionDestruction(session, choices: nil) and UIApplication.shared.requestSceneSessionRefresh(session), however neither labored.

Thanks!



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments