             returnDict[key] = value
         }
         
-        returnDict[kSecClass] = kSecClassGenericPassword
+        returnDict[kSecClass as String] = kSecClassGenericPassword
         
-        returnDict[kSecValueData] = NSJSONSerialization.dataWithJSONObject(self.values, options: .allZeros, error: nil)
+        do {
+            try returnDict[kSecValueData as String] = NSJSONSerialization.dataWithJSONObject(self.values, options: NSJSONWritingOptions())
+        } catch _ {
+            
+        }
         
         return returnDict
     }
     
     private func writeKeychainData() {
-        var attributes: Unmanaged<AnyObject>?
+        var attributes: AnyObject?
         var updateItem: [String: AnyObject]?
         
         var result: OSStatus?

        }
    }
    
    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] = ""
    }
    
    private func secItemDataToDict(data: [String: AnyObject]) -> [String: AnyObject] {

            assert(result == noErr, "Failed to add keychain item")
        } else {
            updateItem = [String: AnyObject]()
            for (key, value) in attributes as! [String: AnyObject] {
                updateItem![key] = value
            }
            updateItem![kSecClass as String] = self.genericPasswordQuery[kSecClass as String]
            
            var tempCheck = self.dictToSecItemData(self.keychainItemData)
            tempCheck.removeValueForKey(kSecClass as String)
            
            if TARGET_IPHONE_SIMULATOR == 1 {
                tempCheck.removeValueForKey(kSecAttrAccessGroup as String)
            }
            
            result = SecItemUpdate(updateItem! as CFDictionary, tempCheck as CFDictionary)
            assert(result == noErr, "Failed to update keychain item")
        }
    }
}
