Düzenle

Aracılığıyla paylaş


UIApplicationDelegate.OpenUrl Method

Definition

Overloads

OpenUrl(UIApplication, NSUrl, NSDictionary)

Indicates that the application should open the specified url with context from options.

OpenUrl(UIApplication, NSUrl, UIApplicationOpenUrlOptions)

Indicates that the application should open the specified url according to options.

OpenUrl(UIApplication, NSUrl, String, NSObject)

Indicates that the application should open the specified url.

OpenUrl(UIApplication, NSUrl, NSDictionary)

Indicates that the application should open the specified url with context from options.

[Foundation.Export("application:openURL:options:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual bool OpenUrl (UIKit.UIApplication app, Foundation.NSUrl url, Foundation.NSDictionary options);
abstract member OpenUrl : UIKit.UIApplication * Foundation.NSUrl * Foundation.NSDictionary -> bool
override this.OpenUrl : UIKit.UIApplication * Foundation.NSUrl * Foundation.NSDictionary -> bool

Parameters

url
NSUrl
options
NSDictionary

Returns

Attributes

Applies to

OpenUrl(UIApplication, NSUrl, UIApplicationOpenUrlOptions)

Indicates that the application should open the specified url according to options.

[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public bool OpenUrl (UIKit.UIApplication app, Foundation.NSUrl url, UIKit.UIApplicationOpenUrlOptions options);
member this.OpenUrl : UIKit.UIApplication * Foundation.NSUrl * UIKit.UIApplicationOpenUrlOptions -> bool

Parameters

url
NSUrl

Returns

Attributes

Applies to

OpenUrl(UIApplication, NSUrl, String, NSObject)

Indicates that the application should open the specified url.

[Foundation.Export("application:openURL:sourceApplication:annotation:")]
[ObjCRuntime.Obsoleted(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, "Override 'OpenUrl (UIApplication, NSUrl, NSDictionary)'. The later will be called if both are implemented.")]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual bool OpenUrl (UIKit.UIApplication application, Foundation.NSUrl url, string sourceApplication, Foundation.NSObject annotation);
abstract member OpenUrl : UIKit.UIApplication * Foundation.NSUrl * string * Foundation.NSObject -> bool
override this.OpenUrl : UIKit.UIApplication * Foundation.NSUrl * string * Foundation.NSObject -> bool

Parameters

application
UIApplication

Reference to this application (SharedApplication).

url
NSUrl

The NSUrl specified by the calling application.

sourceApplication
String

The bundle ID of the calling application.

annotation
NSObject

Optional property-list data passed by the calling application.

Returns

true if the application succcessfully handled the url.

Attributes

Remarks

When overridden, the application should open the url and return a boolean indicating whether the retrieval was successful.

If the origin of the request was another application, the methods WillFinishLaunching(UIApplication, NSDictionary) and FinishedLaunching(IUIApplicationDelegate, UIApplication, NSDictionary) will be called prior to this method and can be used to prevent this method from being called.

If the url originated in a UIDocumentInteractionController, the annotation may contain additional information specified by the sourceApplication. Files sent via UIDocumentInteractionController will be in the application's Documents/Inbox directory. Applications do not have write access to this directory, so if the file needs to be modified, it must be moved to a write-enabled directory. If the file is protected and the user locks the device, it will be inaccessible. (see ProtectedDataDidBecomeAvailable(UIApplication) and ProtectedDataAvailable).

Applications that wish to be activated using M:UIKit.UIApplicationDelegate.OpenURL* must set the CFBundleURLTypes in their Info.plist file, as a child of the <plist><dict> element. The following example shows how a viewer to handle the URL scheme foo://host:port/path?query might be declared:

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.xamarin.MyUniqueIdentifier</string>
<key>CFBundleURLSchemes</key>
<array>
<string>foo</string>
</array>
<key>CFBundleURLTypes</key>
<string>Viewer</string>
</dict>
</array>

Applies to