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
1
vote
1 answer

application(:didFinishLaunchingwithOptions:) does not get called if apps is killed and opened immediately

I have noticed that if I kill the app from the multitasking view and open it immediately application(:didFinishLaunchingwithOptions:) lifecycle method is not called but the sceneDelegate's scene(:willConnectTo:) method is called. As far as I know,…
Nikhil Muskur
  • 208
  • 1
  • 11
1
vote
1 answer

Error when requesting review using SKStoreReviewController

When I use SKStoreReviewController.requestReview() to request a review from the Scene Delegate in my SwiftUI application, I get the following message: Error in UIKit client: -[UIWindow setScreen:] should not be called if the client adopts UIScene…
Todd
  • 500
  • 4
  • 10
1
vote
1 answer

Detect when application is terminated in SwiftUI 2.0

I'm working in Swift UI 2.0 and currently have a setup as follows: @main struct MyApp: App { @Environment(\.scenePhase) private var scenePhase var body: some Scene { WindowGroup { InitialView() } …
Evan
  • 1,892
  • 2
  • 19
  • 40
1
vote
0 answers

iOS 14 Document based app adopting SceneDelegate?

I'm recently developing a new document based app. The traditional, and by now, the official template is instantiating an UIDocumentBrowser in the AppDelegate; and the official recommendation for document based app to use the document browser as the…
zrfrank
  • 2,631
  • 1
  • 12
  • 18
1
vote
3 answers

Determine background status with SwiftUI

When using SwiftUI with iOS 13+, the traditional means of determining background state no longer work. For example: AppDelegate methods applicationDidEnterBackground(_ application: UIApplication) and applicationDidBecomeActive(_ application:…
davidgyoung
  • 63,876
  • 14
  • 121
  • 204
1
vote
1 answer

Migrating old Xcode project to new one with UISceneDelegate

I have an old Xcode project without UISceneDelegate methods. Is it possible to migrate an old Xcode project to a new one with UISceneDelegate methods BUT still maintaining compatibility with iOS 12? If so, how? Because I see a lot of bugs in iOS 14…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
1
vote
1 answer

SwiftUI, changing a view from scene(:continue

In a SwiftUI app, I am facing a new challenge and hope someone can give me some hints or guidance. The mechanisms I have seen up to now to communicate between the parts of an app don't seem to quite fit here. But it is probably due to my still…
Michel
  • 10,303
  • 17
  • 82
  • 179
1
vote
0 answers

How to add subview to UIWindow Scene iOS 13

I have created a in house framework which works perfectly fine till iOS 12, as I am adding a button (floating button) on window so that it is visible on entire app. I have created a UIWindow class to add a button, check below code public class…
1
vote
2 answers

Detect when a specific view is opened from the background in SwiftUI?

If I have a SwiftUI view and I put it into the background (i.e. hit the home button once on the iPhone) and then reopen it again, I would like to trigger some action. My first thought was to make use of the .onAppear{} modifier, but, after some…
Evan
  • 1,892
  • 2
  • 19
  • 40
1
vote
1 answer

How to get rootViewController in iOS 13 using Objective-C?

I'm trying to get the rootViewController in iOS 13 using Objective-C. I'm doing something like this: for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) { UIWindowScene *windowScene = (UIWindowScene *) scene; …
pableiros
  • 14,932
  • 12
  • 99
  • 105
1
vote
1 answer

black screen with sceneDelegate when using storyboard

First shows AuthViewController (aka root) then a black screen with tabBarController, but without item on it. What could be the problem? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions:…
1
vote
2 answers

Autologin functionality in swift

I want to implement Autologin functionality. when i will open my app it will go to "loginViewController".And after login i am saving the login id to UserDefaults.And for the second time if UserDefaults has the value the ift will go to…
Tapan Raut
  • 850
  • 6
  • 17
1
vote
2 answers

Opening content from URL Scheme when App is closed

My issue I'm implementing URL Schemes in my application and they're overall working fine when the app is in the foreground or the background. However, I've noticed that when it is completely closed and another app tries to access content using my…
Luna Debb
  • 49
  • 7
1
vote
1 answer

Cannot access SceneDelegate class variable/property

I'm trying to access a variable declared in the SceneDelegate, however, I can't access it. My code in my viewcontroller is as: let sceneDelegate = self.view.window.windowScene.delegate let variableToAccess = sceneDelegate.variableToAccess I thought…
SMSidat
  • 1,163
  • 1
  • 15
  • 34
1
vote
0 answers

SceneDelegate vs AppDelegate

Hi I want to check if the user use AppDelegate or SceneDelegate as I want to swizzle functions like DidBecomeActive, so how to check it? I was thinking of checking this by detecting if the user use Application Scene Manifest in the info.plist, Can…