Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is the return value of application:openURL:options: used?

Reading the documentation for UIApplicationDelegate - application:openURL:options

Return:

YES if the delegate successfully handled the request or NO if the attempt to open the URL resource failed.

What does returning YES vs NO impact? Is it just a convenience if you happen to be sub-classing your app delegate and might want to let super handle the invocation? The return value doesn't seem to affect the behavior of UIApplication itself in any obvoius way.

like image 739
Ben Flynn Avatar asked Mar 02 '17 22:03

Ben Flynn


People also ask

How does the OpenURL method work?

The OpenURL method runs with the same permissions as your app itself. For example, if your app is running as a WebGL player in a desktop web browser, it will not be able to access local files on the machine, because the WebGL platform itself runs inside a security sandbox which prevents that.

Is it safe to use OpenURL in my App?

If your app uses OpenURL to open URL strings which come from a third party, or which are put together using any user-supplied data, the user-supplied data should be considered untrusted and may be used to run arbitrary code under the same permissions of your app itself.

What is the URL resource to open?

The URL resource to open. This resource can be a network resource or a file. For information about the Apple-registered URL schemes, see Apple URL Scheme Reference. A dictionary of URL handling options.

What does the open url deluge task do?

The open url deluge task when executed takes the user to the specified url. The URL can also be opened in iframe. Support for iframe provides huge opportunities for developers to improve the interface/interaction of their applications and provide Web 2.


1 Answers

application:openURL:options should be implemented if the app opens deep links including waiting for a callback from another app as facebook login.

The URL/URI parameter value should contains the needed information to let you figure out to which view controller the app should be re-directed to.

One example with facebook callback there is facebookSDK method that can be called and it will handle the URI parsing for you.

If you decide to open the app you should return YES/true, and then proceed with re-directing. Otherwise, return NO/false.

If app accepts info. from 3rd party apps. This method allow you to check the validity of this info. and regardingly accept the request or reject it.

like image 98
hasan Avatar answered Nov 15 '22 21:11

hasan