Posts

Post not yet marked as solved
3 Replies
I'm having the same issue. I have three apps with the same code base. Two of them were approved and the other one was rejected. For some reason when I try to get the info from the keychain using apple sign-in I get no results. Here is my code to load/save data.  class func save(key: String, data: Data) throws {     let query: [String: Any] = [kSecClass as String: kSecClassGenericPassword,                                 kSecValueData as String: data,                                 kSecAttrAccount as String: key]     SecItemDelete(query as CFDictionary)     let status = SecItemAdd(query as CFDictionary, nil)     if status != errSecSuccess {       throw error(from: status)     }   }   class func load(key: String) throws - Data? {     let query: [String: Any] = [kSecClass as String: kSecClassGenericPassword,                                 kSecMatchLimit as String: kSecMatchLimitOne,                                 kSecReturnData as String: true,                                 kSecAttrAccount as String: key]     var queryResult: AnyObject?     let status = withUnsafeMutablePointer(to: &queryResult) {       SecItemCopyMatching(query as CFDictionary, $0)     }     switch status {     case errSecSuccess:       let dataType = type(of: queryResult)       guard let data = queryResult as? Data else {         throw KeyChainError.dataConversionError(actualType: "'\(dataType)'")       }       return data     case errSecItemNotFound:       return nil     default:       throw error(from: status)     }   } Is there any possible solution for this issue?
Post not yet marked as solved
34 Replies
I'm having the same issue. I have three apps with the same code base. Two of them were approved and the other one was rejected. For some reason when I try to get the info from the keychain using apple sign-in I get no results. Here is my code to load/save data. class func save(key: String, data: Data) throws {     let query: [String: Any] = [kSecClass as String: kSecClassGenericPassword,                                 kSecValueData as String: data,                                 kSecAttrAccount as String: key]     SecItemDelete(query as CFDictionary)     let status = SecItemAdd(query as CFDictionary, nil)     if status != errSecSuccess {       throw error(from: status)     }   }   class func load(key: String) throws - Data? {     let query: [String: Any] = [kSecClass as String: kSecClassGenericPassword,                                 kSecMatchLimit as String: kSecMatchLimitOne,                                 kSecReturnData as String: true,                                 kSecAttrAccount as String: key]     var queryResult: AnyObject?     let status = withUnsafeMutablePointer(to: &queryResult) {       SecItemCopyMatching(query as CFDictionary, $0)     }     switch status {     case errSecSuccess:       let dataType = type(of: queryResult)       guard let data = queryResult as? Data else {         throw KeyChainError.dataConversionError(actualType: "'\(dataType)'")       }       return data     case errSecItemNotFound:       return nil     default:       throw error(from: status)     }   } Is there any possible solution for this issue?