title: Corresponding value of kSecAttrAccessControl?
body: <p>What is the type of the corresponding value of kSecAttrAccessControl? From the docs, it says that the value will be the return value of <a href="https://developer.apple.com/library/prerelease/ios/documentation/Security/Reference/keychainservices/#//apple_ref/c/func/SecAccessControlCreateWithFlags" rel="nofollow">SecAccessControlCreateWithFlags(_:_:_:_:)</a> and can be used in creating a query for SecItemAdd, etc.</p>
  
  <p>However, in Swift 2, this does not seem to work. I get errSecParam error when I try to add an item. It is understood that in Swift 1, you can use .takeRetainedValu() to solve this. But, that doesn't seem to be the case in Swift 2.</p>
  
  <p>Here is the Psuedo code:</p>
  
  <pre><code>    func addItem() -&gt; String {
  
      // Build a query for adding a keychain item.
      let account: String! = "testAccount"
      let service: String! = "testService"
      let accessible: String! = kSecAttrAccessibleWhenUnlocked as String
      let data: NSData! = "test data".dataUsingEncoding(NSUTF8StringEncoding)
  
      let acl: SecAccessControl = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenUnlocked, .UserPresence, nil)!
  
      let query = [
          kSecClass as String         :   kSecClassGenericPassword as String,
          kSecAttrAccount as String   :   account,
          kSecAttrService as String   :   service,
          kSecAttrAccessible as String:   accessible,
          kSecAttrAccessControl as String :   acl, //errSecParam because of acl!
          kSecValueData as String     :   data
      ] as NSDictionary
  
      status = SecItemAdd(query, nil)
  
      if status != errSecSuccess {
          print("[addItem::SecItemAdd] \(osstatusToHumanReadable(status))")
      }
  
      return osstatusToHumanReadable(status)
  }
  </code></pre>