Compartilhar via


UIApplication.ProtectedDataDidBecomeAvailable Propriedade

Definição

Indica que o estado dos dados protegidos foi alterado.

[Foundation.Advice("Use UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable helper method instead.")]
[Foundation.Field("UIApplicationProtectedDataDidBecomeAvailable", "UIKit")]
public static Foundation.NSString ProtectedDataDidBecomeAvailable { get; }
member this.ProtectedDataDidBecomeAvailable : Foundation.NSString

Valor da propriedade

Atributos

Comentários

Essa constante pode ser usada com o NSNotificationCenter para registrar um ouvinte para essa notificação. Esse é um NSString em vez de uma cadeia de caracteres, pois esses valores podem ser usados como tokens em algumas bibliotecas nativas, em vez de serem usados puramente para seu conteúdo de cadeia de caracteres real. O parâmetro 'notification' para o retorno de chamada contém informações extras específicas para o tipo de notificação.

Se você quiser assinar esta notificação, poderá usar a conveniência UIApplication.Notifications. Método M:UIKit.UIKit.UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable* que oferece acesso fortemente tipado aos parâmetros da notificação.

O exemplo a seguir mostra como usar a classe Notifications fortemente tipada para tirar o guesswork das propriedades disponíveis na notificação:

//
// Lambda style
//

// listening
notification = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable ((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 = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable (Callback);
}

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

O exemplo a seguir mostra como usar a notificação com a API DefaultCenter:

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


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

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (UIApplication.ProtectedDataDidBecomeAvailable, Callback);
}

Aplica-se a

Confira também