When creating a UTI in UIKit for iOS and associating the UTI with the application(using CFBundleDocumentTypes), I've noticed the following behaviour:
- If the application is already running, on opening a file associated with the app, only the OpenUrl delegate method gets called
- When the app is in the terminated state, when an associated file is opened, it triggers the “WillFinishLaunching”, “DidFinishLaunching” and then the “OpenUrl” delegate method
In both cases we get the file or a list of files at the OpenUrl stage.
This is unlike the AppKit behavior in Macos, where if files are dropped on the icon and the application is ‘launched’ – you get the file list BEFORE ‘DidFinishLaunching’, and files dropped on ‘running application’ is after DidFinishLaunching.
Is this behavior engineered to be different or am I missing something here?
Quoting a line from the UIKit OpenUrl page:
This method is not called if your implementations return NO from both the application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods. (If only one of the two methods is implemented, its return value determines whether this method is called.)
Does this mean that we should access the URLs sent while opening the file before initializing the application(ie. in didFinishLaunchingWithOptions)