NSPersistentStoreCoordinator.DidImportUbiquitousContentChangesNotification Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Константа уведомлений для 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
Значение свойства
Константа NSString должна использоваться в качестве токена для NSNotificationCenter.
- Атрибуты
Комментарии
Эту константу можно использовать с для NSNotificationCenter регистрации прослушивателя для этого уведомления. Это NSString вместо строки, так как эти значения можно использовать в качестве маркеров в некоторых собственных библиотеках, а не только для их фактического содержимого строк. Параметр notification для обратного вызова содержит дополнительные сведения, относящиеся к типу уведомления.
Если вы хотите подписаться на это уведомление, можно использовать удобный NSPersistentStoreCoordinator.Notificationsметод ,ObserveDidImportUbiquitousContentChanges который предоставляет строго типизированный доступ к параметрам уведомления.
В следующем примере показано, как использовать строго типизированный класс Notifications, чтобы вывести догадки из доступных свойств в уведомлении:
//
// 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 ();
}
В следующем примере показано, как использовать уведомление с API DefaultCenter:
// 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);
}