Questions tagged [uiscenedelegate]

Methods you use to respond to life-cycle events occurring within a scene.

UISceneDelegate is available in UIKit since iOS 13.

From https://developer.apple.com/documentation/uikit/uiscenedelegate?language=objc

Use your UISceneDelegate object to manage life-cycle events in one instance of your app's user interface. This interface defines methods for responding to state transitions that affect the scene, including when the scene enters the foreground and becomes active, and when it enters the background. Use your delegate to provide appropriate behavior when these transitions occur. For example, finish critical tasks and quiet your app when it enters the background.

Do not create UISceneDelegate objects directly. Instead, specify the name of your custom delegate class as part of the configuration data for your scenes. You can specify this information in your app's Info.plist file, or in the UISceneConfiguration object you return from your app delegate's application:configurationForConnectingSceneSession:options: method.

156 questions
98
votes
9 answers

UIApplication.shared.delegate equivalent for SceneDelegate xcode11?

I have defined a let property within my SceneDelegate. I would like some of the ViewControllers to be able to access that within the scene. In UIKit I could access App Delegate properties like this: UIApplication.shared.delegate then casting and…
zumzum
  • 17,984
  • 26
  • 111
  • 172
78
votes
3 answers

App delegate methods aren't being called in iOS 13

I am using Xcode 11 and building an app for iOS 13. In a new project I created in Xcode some of the UIApplicationDelegate methods were missing so I added them back into the app delegate file. The new template for a "Single View App" project was…
nevan king
  • 112,709
  • 45
  • 203
  • 241
48
votes
12 answers

UIWindow not showing over content in iOS 13

I am upgrading my app to use the new UIScene patterns as defined in iOS 13, however a critical part of the app has stopped working. I have been using a UIWindow to cover the current content on the screen and present new information to the user, but…
mHopkins
  • 590
  • 1
  • 4
  • 10
25
votes
3 answers

AppDelegate and SceneDelegate when supporting iOS 12 and 13

I need to support iOS 12 and iOS 13. Should I be duplicating code between AppDelegate and SceneDelegate? For example: func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { …
Teddy K
  • 820
  • 1
  • 6
  • 17
23
votes
2 answers

How get rootViewController with iPadOS multi window (SceneDelegate)?

I am using Xcode 11 (beta3) and building an app for iOS 13. In my project I created the delegate methods for UIWindowSceneDelegate declaring it in Info.plist. Now I'm able to create multiple windows (and UIScene). How can I access the…
Fabiosoft
  • 1,141
  • 14
  • 32
19
votes
2 answers

UIScene concept is not clear

Before we all get used to the approach when in AppDelegate we create UIWindow and then set rootViewController for this Window. Sometimes when we needed to have a custom alert we can create a new UIWindow that will be above. Now Xcode automatically…
Paul T.
  • 4,938
  • 7
  • 45
  • 93
18
votes
1 answer

Why is UIApplicationDelegate method `application(_:configurationForConnecting:options:)` not called reliably

Issue: I find some unexpected behavior regarding the AppDelegate method application(_:configurationForConnecting:options:). The documentation states: UIKit calls this method shortly before creating a new scene. I would expect that this is the case…
de.
  • 7,068
  • 3
  • 40
  • 69
16
votes
4 answers

`scene(_ scene: UIScene, continue userActivity: NSUserActivity)` doesn't get called when the app is launched after the user clicks on a universal link

Method scene(_ scene: UIScene, continue userActivity: NSUserActivity) doesn't get called when the app is launched after the user clicks on a universal link. It works fine when already launched app opens again after the user clicks on the universal…
Dmitry
  • 527
  • 5
  • 13
10
votes
3 answers

Dynamic Links not working when app is closed, only when in background

I've been working to include Dynamic Links in my app. I have set it up so that links can be generated correctly, and received correctly, but they only work when the app is open and in the background. If the app is closed completely, the link will…
10
votes
7 answers

How get current keywindow equivalent for multi window SceneDelegate Xcode 11?

I'm converting my iOS13 app for iPadOS to SceneDelegate (multi window). How can I get the current UIWindow from the current SceneDelegate? I know that a can access the current scene using UIView.window or UIViewController.view.window, but I have a…
Fabiosoft
  • 1,141
  • 14
  • 32
9
votes
1 answer

How to launch multiple instances of a scene on iPhone with iOS 13?

The apple developer docs mentions that multiple instances of a scene are available on iOS 13 (ie both iPhone and iPad) From their developer docs: In iOS 13 and later, the user can create and manage multiple instances of your app's user interface…
mohit
  • 154
  • 2
  • 9
7
votes
1 answer

IOS 13 cant handle universallink click when app opened with link click

I am trying to handle open apps from universal link click. below ios 13 its working good but for ios 13 its working only app running in background. If app not working foreground or background, clicking link opens app not called continue…
nikinci
  • 444
  • 6
  • 25
7
votes
0 answers

Is the UISceneDelegate scene(_:openURLContexts:) method ever called on a specific scene or just the "first"?

I know that the UISceneDelegate scene(_:openURLContexts:) delegate method is meant as the UIScene equivalent of the UIApplicationDelegate application(_:open:options:) delegate method. But an app can have multiple active scenes while only one will…
rmaddy
  • 314,917
  • 42
  • 532
  • 579
6
votes
4 answers

Deep Links with AppDelegate and SceneDelegate

I am trying to implement deep links to navigate to posts on an app, it was an older project so I had to add the SceneDelegate class. The deep link implementation works only when the app is active or in background. If the app has not been loaded the…
ShedSports
  • 541
  • 2
  • 7
  • 14
6
votes
1 answer

SceneDelegate function is never called

I have a SwiftUI/SpriteKit project. In an error-laden quest to change the bundle identifier, I decided to create a new project and copy my files over. Now I've got this new project with all my old files but when I run it, I get a blank screen…
West1
  • 1,430
  • 16
  • 27
1
2 3
10 11