Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在swift和IOS 10崩溃中重置钥匙链_Swift_Keychain_Ios10_Swift2.3 - Fatal编程技术网

在swift和IOS 10崩溃中重置钥匙链

在swift和IOS 10崩溃中重置钥匙链,swift,keychain,ios10,swift2.3,Swift,Keychain,Ios10,Swift2.3,该问题仅在Xcode 8和IOS 10中发生。 如果我使用XCode 8和IOS 9,它工作得非常好 func resetKeychain() { if !self.keychainItemData.isEmpty { let tempDict = self.dictToSecItemData(self.keychainItemData) var junk = noErr junk = SecItemDelete(tempDict as

该问题仅在Xcode 8和IOS 10中发生。 如果我使用XCode 8和IOS 9,它工作得非常好

func resetKeychain() {

    if !self.keychainItemData.isEmpty {
        let tempDict = self.dictToSecItemData(self.keychainItemData)
        var junk = noErr
        junk = SecItemDelete(tempDict as CFDictionary)

        assert(junk == noErr || junk == errSecItemNotFound, "Failed to delete current dict")
    }

    self.keychainItemData[kSecAttrAccount] = ""
    self.keychainItemData[kSecAttrLabel] = ""
    self.keychainItemData[kSecAttrDescription] = ""

    self.keychainItemData[kSecValueData] = ""
}
断言总是发生在IOS 10和应用程序崩溃中


有什么想法吗?

在您的Xcode项目中,转到应用程序目标,然后转到功能。打开钥匙链共享。那就应该成功了

在您的Xcode项目中,转到应用程序目标,然后转到功能。打开钥匙链共享。那就应该成功了

我甚至没有想到它是在升级到XCode 8Life saver之前启用的!为我工作!我甚至没有想到它是在升级到XCode 8Life saver之前启用的!为我工作!