3

When iOS 13 released, I opted out of using the new SceneDelegate through the normal procedures.

 - SceneDelegate.swift does no longer exist
 - There are no Scene related methods in AppDelegate
 - Application Scene Manifest is removed from .plist

This worked great, and is how I've been running since (iOS 11.0 target, Xcode 11.2.1).

Last week I ran a build with deployment target as 13.0, then swapped back to 11.0.

Since then, the application delegate methods are no longer being called, such as.

func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any])

The only thing that happens, that I can see is a log in console

Can't end BackgroundTask: no background task exists with identifier 15 (0xf), or it may have already been ended

I've triple checked all the settings above, but I can't get it to work like it used to.

The only thing that might be different is that the storyboards now defaults to 'automatic' (iOS 13.0, *) presentation mode, but I'm not sure how it was before.

Since automatic is only available from iOS 13+, it seems like something is messed up.

Does anyone have a clue?

Following up on the response in this thread:

applicationDidBecomeActive
applicationWillEnterForeground

etc are actually called.

I've tried cleaning the build, restarting Xcode, the mac, the device, clearing derived data etc.

buddhabath
  • 664
  • 1
  • 10
  • 22
  • 2
    show methods currently available in AppDelegate class. – Help Dec 17 '19 at 06:01
  • Could you please share more of your code on Github or something? have you tried all of these https://stackoverflow.com/questions/23882495/cant-endbackgroundtask-no-background-task-exists-with-identifier-or-it-may-ha ? – Saamer Dec 19 '19 at 00:10

2 Answers2

0

So, I finally found the answer.

Turns out it's a good old

Instance Method Nearly Matches

func application(_ application: UIApplication, continue userActivity: NSUserActivity,
    restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool

That Xcode completely ignored to report, and somehow managed to break in between building for iOS 11 > iOS 13 > iOS 11.

It's also strange because I verified them a couple of days ago with the documentation, both Apples & Firebase, and there was no difference between them.

In the end, it works now, yay.

buddhabath
  • 664
  • 1
  • 10
  • 22
0

If you don't need want to use the SceneDelegate then add below property in the AppDelegate file.

var window: UIWindow?

Add this line above didFinishLaunchingWithOptions function

var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
    {
     // Override point for customization after application launch.
            return true
    }
Krishna
  • 293
  • 3
  • 11