Freigeben über


UIApplicationDelegate.OpenUrl Methode

Definition

Überlädt

OpenUrl(UIApplication, NSUrl, NSDictionary)

Gibt an, dass die Anwendung das angegebene url mit Kontext aus optionsöffnen soll.

OpenUrl(UIApplication, NSUrl, UIApplicationOpenUrlOptions)

Gibt an, dass die Anwendung das angegebene url gemäß optionsöffnen soll.

OpenUrl(UIApplication, NSUrl, String, NSObject)

Gibt an, dass die Anwendung das angegebene urlöffnen soll.

OpenUrl(UIApplication, NSUrl, NSDictionary)

Gibt an, dass die Anwendung das angegebene url mit Kontext aus optionsöffnen soll.

[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

Parameter

url
NSUrl
options
NSDictionary

Gibt zurück

Attribute

Gilt für:

OpenUrl(UIApplication, NSUrl, UIApplicationOpenUrlOptions)

Gibt an, dass die Anwendung das angegebene url gemäß optionsöffnen soll.

[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

Parameter

url
NSUrl

Gibt zurück

Attribute

Gilt für:

OpenUrl(UIApplication, NSUrl, String, NSObject)

Gibt an, dass die Anwendung das angegebene urlöffnen soll.

[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

Parameter

application
UIApplication

Verweis auf diese Anwendung (SharedApplication).

url
NSUrl

Die NSUrl von der aufrufenden Anwendung angegebene.

sourceApplication
String

Die Bundle-ID der aufrufenden Anwendung.

annotation
NSObject

Optionale Eigenschaftslistendaten, die von der aufrufenden Anwendung übergeben werden.

Gibt zurück

true , wenn die Anwendung erfolgreich behandelt urlhat.

Attribute

Hinweise

Beim Überschreiben sollte die Anwendung öffnen url und einen booleschen Wert zurückgeben, der angibt, ob der Abruf erfolgreich war.

Wenn der Ursprung der Anforderung eine andere Anwendung war, werden die Methoden WillFinishLaunching(UIApplication, NSDictionary) und FinishedLaunching(IUIApplicationDelegate, UIApplication, NSDictionary) vor dieser Methode aufgerufen und können verwendet werden, um zu verhindern, dass diese Methode aufgerufen wird.

Wenn der url aus einem UIDocumentInteractionControllerstammt, kann der annotation zusätzliche Informationen enthalten, die sourceApplicationdurch angegeben werden. Über gesendete UIDocumentInteractionController Dateien befinden sich im Verzeichnis der Documents/Inbox Anwendung. Anwendungen haben keinen Schreibzugriff auf dieses Verzeichnis. Wenn die Datei geändert werden muss, muss sie in ein Schreibzugriffsverzeichnis verschoben werden. Wenn die Datei geschützt ist und der Benutzer das Gerät sperrt, kann nicht darauf zugegriffen werden. (siehe ProtectedDataDidBecomeAvailable(UIApplication) und ProtectedDataAvailable).

Anwendungen, die mithilfe von M:UIKit.UIApplicationDelegate.OpenURL* aktiviert werden möchten, müssen das in ihrer CFBundleURLTypesInfo.plist Datei als untergeordnetes Element <plist><dict> festlegen. Das folgende Beispiel zeigt, wie ein Viewer zum Behandeln des URL-Schemas foo://host:port/path?query deklariert werden kann:

<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>

Gilt für: