Freigeben über


NSPersistentStoreCoordinator.DidImportUbiquitousContentChangesNotification Eigenschaft

Definition

Benachrichtigungskonstante für DidImportUbiquitousContentChanges

[Foundation.Advice("Use NSPersistentStoreCoordinator.Notifications.ObserveDidImportUbiquitousContentChanges helper method instead.")]
[Foundation.Field("NSPersistentStoreDidImportUbiquitousContentChangesNotification", "CoreData")]
[ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, "Please see the release notes and Core Data documentation.")]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
public static Foundation.NSString DidImportUbiquitousContentChangesNotification { [ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, "Please see the release notes and Core Data documentation.")] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.DidImportUbiquitousContentChangesNotification : Foundation.NSString

Eigenschaftswert

Die NSString-Konstante sollte als Token für NSNotificationCenter verwendet werden.

Attribute

Hinweise

Diese Konstante kann mit dem NSNotificationCenter verwendet werden, um einen Listener für diese Benachrichtigung zu registrieren. Dies ist ein NSString anstelle einer Zeichenfolge, da diese Werte in einigen nativen Bibliotheken als Token verwendet werden können, anstatt nur für ihren tatsächlichen Zeichenfolgeninhalt verwendet zu werden. Der Parameter "notification" für den Rückruf enthält zusätzliche Informationen, die für den Benachrichtigungstyp spezifisch sind.

Wenn Sie diese Benachrichtigung abonnieren möchten, können Sie die praktische NSPersistentStoreCoordinator.Notifications.ObserveDidImportUbiquitousContentChanges -Methode verwenden, die stark typisierten Zugriff auf die Parameter der Benachrichtigung bietet.

Das folgende Beispiel zeigt, wie Sie die stark typisierte Notifications-Klasse verwenden, um die verfügbaren Eigenschaften in der Benachrichtigung zu entmutigen:

//
// Lambda style
//

// listening
notification = NSPersistentStoreCoordinator.Notifications.ObserveDidImportUbiquitousContentChanges ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);
});

// To stop listening:
notification.Dispose ();

//
// Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSNotificationEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);
}

void Setup ()
{
    notification = NSPersistentStoreCoordinator.Notifications.ObserveDidImportUbiquitousContentChanges (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

Das folgende Beispiel zeigt, wie Sie die Benachrichtigung mit der DefaultCenter-API verwenden:

// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        NSPersistentStoreCoordinator.DidImportUbiquitousContentChangesNotification, (notification) => {Console.WriteLine ("Received the notification NSPersistentStoreCoordinator", notification); }


// Method style
void Callback (NSNotification notification)
{
    Console.WriteLine ("Received a notification NSPersistentStoreCoordinator", notification);
}

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (NSPersistentStoreCoordinator.DidImportUbiquitousContentChangesNotification, Callback);
}

Gilt für: