浏览代码

Merge pull request #198 from nickskull/master

Fix casting an optional CFArray to Swift array in shared web credentials
kishikawa katsumi 9 年之前
父节点
当前提交
2b3a8e359a
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      Lib/KeychainAccess/Keychain.swift

+ 3 - 2
Lib/KeychainAccess/Keychain.swift

@@ -870,8 +870,9 @@ public class Keychain {
                     print("error:[\(remoteError!.code)] \(remoteError!.localizedDescription)")
                     print("error:[\(remoteError!.code)] \(remoteError!.localizedDescription)")
                 }
                 }
             }
             }
-            if let credentials = credentials as? [[String: AnyObject]] {
-                let credentials = credentials.map { credentials -> [String: String] in
+            if let credentials = credentials {
+                let casted = credentials as NSArray
+                let credentials = casted.map { credentials -> [String: String] in
                     var credential = [String: String]()
                     var credential = [String: String]()
                     if let server = credentials[AttributeServer] as? String {
                     if let server = credentials[AttributeServer] as? String {
                         credential["server"] = server
                         credential["server"] = server