SFAuthorizationVew does not display in PrefPane (NSPreferencePane)

| | August 4, 2015

The SFAuthorizationView placed in a PrefPane (subclass of NSPreferencePane) does not display in SystemPreferences. This is under 10.10.4 and XCode 6.4. This occurs only in Apple’s PrefPane template from 6.4, the same code works from a different project (BDAuthorizePrefPane). I can not figure out the difference between the two projects.

Steps to re-create:

  • Start a new Xcode project
    • OS X -> System Plug-in
    • choose “Preference Pane” for the template
  • Add an NSView in the xib
    • change the class to SFAuthorizationView
  • Add the appropriate IBOutlet to the main class
  • Optionally debug SystemPreferences

The code initializes the SFAuthorizationView in mainViewDidLoad (see also BDAuthorizePrefPane)

  NSLog(@"Starting TestPref");
  authView.delegate = self;
  AuthorizationItem items = {kAuthorizationRightExecute, 0, NULL, 0};
  AuthorizationRights rights = {1, &items};
  [authView setAuthorizationRights:&rights];

  [authView setAutoupdate:YES];
  [authView updateStatus:self];

Where there should be the paddle lock, no view appears. Why doesn’t the code produce a paddle lock?

Leave a Reply