title: NSLog fixing missing value/crash?
body: <p>My app imports likes from Facebook using <code>Social.framework</code> and <code>ACAccount</code>. I save the Facebook account identifier to <code>NSUserDefaults</code> so that the app can automatically import new likes on subsequent launches. The first import works fine. The problem is with re-instantiating the <code>ACAccount</code> on subsequent launches.</p>
  
  <p>So I have a <code>facebookAccount</code> getter that looks like this:</p>
  
  <pre><code>- (ACAccount *)facebookAccount {
      if(!_facebookAccount) {
          ACAccountStore *accountStore = [[ACAccountStore alloc] init];
          NSString *accountIdentifier = [[NSUserDefaults standardUserDefaults] valueForKey:SWFacebookAccountIdentifierKey];
  
          if(accountIdentifier)
              _facebookAccount = [accountStore accountWithIdentifier:accountIdentifier];
  
      }
      return _facebookAccount;
  }
  </code></pre>
  
  <p>This returns a somehow incomplete <code>ACAccount</code> object:</p>
  
  <pre><code>type:(null)
  identifier: B6E94A67-AF94-408F-A618-6CD4D78564DC
  accountDescription: Facebook
  username: samvermette@gmail.com
  objectID: x-coredata://589C098E-F829-4284-841B-EE4A0003FF21/Account/p2
  enabledDataclasses: {(
      )}
  enableAndSyncableDataclasses: {(
      )}
  properties: {
      fullname = "Sam Vermette";
      uid = 716308665;
  }
  parentAccount: (null)
  owningBundleID:(null) 
  </code></pre>
  
  <p>This gets logged from the method that ends up using this object. As you can see the <code>type</code> value is <code>null</code>, which makes my app throw the following exception: </p>
  
  <blockquote>
    <p>NSInvalidArgumentException', reason: 'Invalid account type for this request</p>
  </blockquote>
  
  <p>Now, the strangest thing is that if I add <code>NSLog(_facebookAccount)</code> right before the <code>return</code> in my getter, the <code>type</code> key is not null and my app doesn't crash. I realize that NSLog fixing this may be a hint at something that's wrong with my code, but I can't figure out what exactly. Any ideas?</p>