title: Crash when trying to access Contacts Framework in iOS 10
body: <p>I am trying to access the Contacts framework so I can save a new contact into the users Addressbook. I have the following code ...</p>
  
  <pre><code>import Contacts
  import ContactsUI
  </code></pre>
  
  <p>at the head of the file and include a method ...</p>
  
  <pre><code>func requestForAccess(completion: (granted: Bool) -&gt; ()) {
  
      dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_BACKGROUND.rawValue), 0), {
          let authStatus = CNContactStore.authorizationStatusForEntityType(.Contacts)
  
          switch authStatus {
          case .Authorized:
              completion(granted: true)
          case .Denied, .NotDetermined:
  
              // CRASH HERE before the completion block is called, after calling 
              // requestAccessForEntityType
  
              self.contactStore.requestAccessForEntityType(.Contacts, completionHandler: { (access, accessError) -&gt; () in
                  if access {
                      completion(granted: access)
                  } else {
                      if authStatus == .Denied {
                          dispatch_async(dispatch_get_main_queue(), { () -&gt; () in
                              let msg = "\(accessError!.localizedDescription)\n\nPlease allow the app to access your contacts through the Settings."
                              //self.alertService.showAlert(msg)
                          })
                      }
                  }
              })
          default:
              completion(granted: false)
          }
      })
  }
  </code></pre>
  
  <p>At the line marked, there is a <code>SIABRT</code> crash. Winding down the stack and running <code>po $arg1</code> throws up the following ...</p>
  
  <pre><code>error: Couldn't materialize: couldn't read the value of register x0
  Errored out in Execute, couldn't PrepareToExecuteJITExpression
  </code></pre>
  
  <p>I have the necessary line in <code>Info.plist</code> in the root <code>dict</code></p>
  
  <pre><code>&lt;key&gt;NSContactsUsageDescription&lt;/key&gt;
  &lt;string&gt;We need to access Contacts to import entries direct from the app.&lt;/string&gt;
  </code></pre>
  
  <p>I have also included <code>Contacts.framework</code> and <code>ContactsUI.framework</code> in 'Linked Frameworks and Libraries' in the target properties (General)</p>