objective-cmacoscocoasfauthorizationpluginview

Redrawing a SFAuthorizationPluginView


I'm writing a custom AuthenticationPlugin which has some dynamic content (currently in the form of labels). I'd like to be able to update the labels in response to events.

Assuming the following declarations:

I edit the label text as follows (note: this may be executed from the background dispatch queue):
[label setStringValue:@"new text"];

I then try to force an update using the following:

However, I get a mixture of no action and flickering grey screen (indicating I've caused an exception).

Any ideas? (Note: I'll be editing this question as I try various options)


Solution

  • I think all you need to do is put the update of the label in the main queue code like this:

    dispatch_async(dispatch_get_main_queue(), ^{
     label.text = "Hello World!";
    });