title: How to display CNContact using CNContactViewController on OSX
body: <p>I am trying to display CNContact on the new CNContactViewController. I am getting no card selected. I tried this with unsaved contact (no go). Also tried with saved+fetched from CNContactStore also no go. Tried with "me" contact but the same result. According to the debugger fetched contact is loaded with correct values and is not nil/empty. App is sandboxed and correctly asks for Contacts permission.</p>
  
  <p>Here is sample:</p>
  
  <pre><code>#import &lt;Contacts/Contacts.h&gt;
  #import &lt;ContactsUI/ContactsUI.h&gt;
  #import "AppDelegate.h"
  
  @interface AppDelegate ()
  
  @property (weak) IBOutlet NSWindow *window;
  @property (strong)  CNContact *contact;
  @property (strong)  CNContactViewController *controller;
  @end
  
  @implementation AppDelegate
  
  - (instancetype)init {
    self = [super init];
    if (self) {
      _controller = [[CNContactViewController alloc] init];
  
    }
    return self;
  }
  
  - (void)awakeFromNib
  {
    CNContactStore *store = [[CNContactStore alloc] init];
    CNMutableContact *mutContact = [[CNMutableContact alloc] init];
    NSString *identifier = [mutContact identifier];
    mutContact.givenName = @"GivenName";
    mutContact.familyName = @"FamilyName";
    CNSaveRequest *saveRequest = [[CNSaveRequest alloc] init];
    [saveRequest addContact:mutContact toContainerWithIdentifier:[store defaultContainerIdentifier]];
    [store executeSaveRequest:saveRequest error:nil];
  
    id keysToFetch = @[[CNContactViewController descriptorForRequiredKeys]];
    _contact = [store unifiedContactWithIdentifier:identifier keysToFetch:keysToFetch error:nil];
  
    dispatch_async(dispatch_get_main_queue(), ^{
      self.controller.contact = self.contact;
      self.window.contentViewController = self.controller;
      self.window.contentView = self.controller.view;
    });
  }
  @end
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/xvGly.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xvGly.png" alt="No card selected"></a></p>
  
  <p>EDIT: 6th of October 2015</p>
  
  <p>Apple's TSI confirmed that they can't get it to work on OS X 10.11.0 </p>