2016-09-14 62 views
1

僅在Xcode 8和IOS 10中才會出現問題。 如果我使用XCode 8和IOS 9,它可以正常工作。在swift和IOS 10崩潰時重置鑰匙串

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發生和應用程序崩潰

什麼想法?

回答

6

在您的Xcode項目中,轉到應用程序目標,然後轉到功能。打開鑰匙串共享。這應該夠了吧!

+0

我甚至沒有想過它,因爲它是更新之前啓用XCode 8 –

+0

救生員!爲我工作! – Politta