Method 'application:openURL:options:' is not called
Implement scene(_:openURLContexts:)
in your scene delegate.
If the URL launches your app, you will get scene(_:willConnectTo:options:)
instead and it’s in the options
.
Launch App using URL, but OpenUrl Not Called
I agree with Kaloyan, "handleOpenURL" is never called at application launch. So you have to check for URL in "launchOptions" in didFinishLaunchingWithOptions.
HOWEVER
I adopted the same solution as Apple example code for QuickActions (3D Touch). I keep the URL at launch in a variable, and I handle it in applicationDidBecomeActive:.
@interface MyAppDelegate ()
@property (nonatomic, strong) NSURL *launchedURL;
@end
@implementation MyAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.launchedURL = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
...
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
if (self.launchedURL) {
[self openLink:self.launchedURL];
self.launchedURL = nil;
}
}
- (BOOL) application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
NSURL *openUrl = url;
if (!openUrl)
{
return NO;
}
return [self openLink:openUrl];
}
- (BOOL)openLink:(NSURL *)urlLink
{
...
}
@end
application:openURL:options: not called after opening universal link
Clay from Branch here.
The application:openURL:sourceApplications:annotation
function (now deprecate to application(_:open:options:)
) is actually only called in response to the old Apple Linking system of standard URI schemes.
Universal links are actually handled within the application(_:continue:restorationHandler:)
function.
// Respond to URI scheme links
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
// pass the url to the handle deep link call
Branch.getInstance().application(app, open: url, options: options)
// do other deep link routing for the Facebook SDK, Pinterest SDK, etc
return true
}
// Respond to Universal Links
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
// pass the url to the handle deep link call
Branch.getInstance().continue(userActivity)
return true
}
Your deep link handling should mostly be dealt with in your handler callback:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let branch: Branch = Branch.getInstance()
branch?.initSession(launchOptions: launchOptions, deepLinkHandler: { params, error in
if error == nil {
// params are the deep linked params associated with the link that the user clicked -> was re-directed to this app
print("params: %@", params.description)
}
})
return true
}
application:openUrl:options not called when opening app from share sheet of another app
If your app is using scenes, then instead of application(_:open:options:)
from UIApplicationDelegate
protocol, iOS will call scene(_:openURLContexts:)
from UISceneDelegate
.
https://developer.apple.com/documentation/uikit/uiscenedelegate/3238059-scene
Also probably it's better to change com.pkware.Zip-archive
to com.pkware.zip-archive
as it's defined as lowercase in the list of System-Declared UTIs
Implementation of application:openURL:sourceApplication:annotation: not found in iOS 8
It seems that Google sign and Facebook are also inserting an app delegate proxy, as per here - https://firebase.google.com/docs/reference/ios/firebaseanalytics/category_f_i_r_analytics_07_app_delegate_08. This seems to conflict with the CleverTap delegate proxy.
So for now please use the manual integration. We'll look into resolving this issue.
Deep link URL Scheme doesn't call any function in iOS App Delegate
In iOS 13, UIApplication
application(_:open:options:)
doesn't get called (at least in my case maybe).
You should override the SceneDelegate functions below instead:
func scene(_ scene: UIScene, openURLContexts URLContexts: Set) {
if let url = URLContexts.first?.url{
print(url)
}
}
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// detect the URLContext in the `options:` and deal with it.
}
If the user taps the link when your app isn't running, scene(_: openURLContexts:)
won't be called but scene(_:willConnectTo:options:)
will be.
Related Topics
How to Tell Swiftui Views to Bind to Nested Observableobjects
Get a List of All Contacts on Ios
How to Scale Down a Uiimage and Make It Crispy/Sharp At the Same Time Instead of Blurry
How to Get a Plist as a Dictionary in Swift
Swrevealviewcontroller Without Using Navigationcontroller
Setting Custom Uitableviewcells Height
Changing Specific Text's Color Using Nsmutableattributedstring in Swift
Unexpectedly Found Nil Iboutlet in Prepareforsegue
How to Make Drawrect Work Right Now
Modal Dialog Does Not Dismiss Keyboard
In Swift, How to Declare a Variable of a Specific Type That Conforms to One or More Protocols
Storyboard Doesn't Contain a View Controller With Identifier
Shouldautorotatetointerfaceorientation Not Being Called in iOS 6
Fade/Dissolve When Changing Uiimageview'S Image
How to Detect Collision in Swift, Sprite Kit
Disable Gesture to Pull Down Form/Page Sheet Modal Presentation