diff --git a/Locksmith.xcodeproj/project.xcworkspace/xcshareddata/Locksmith.xccheckout b/Locksmith.xcodeproj/project.xcworkspace/xcshareddata/Locksmith.xccheckout new file mode 100644 index 0000000..32ca401 --- /dev/null +++ b/Locksmith.xcodeproj/project.xcworkspace/xcshareddata/Locksmith.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 6AAF752A-6001-46C3-BB3E-4EA76720DE90 + IDESourceControlProjectName + Locksmith + IDESourceControlProjectOriginsDictionary + + 9E5DC2F442C5D1D821707804A23B5D894E49AF44 + https://github.com/matthewpalmer/Locksmith + + IDESourceControlProjectPath + Locksmith.xcodeproj + IDESourceControlProjectRelativeInstallPathDictionary + + 9E5DC2F442C5D1D821707804A23B5D894E49AF44 + ../.. + + IDESourceControlProjectURL + https://github.com/matthewpalmer/Locksmith + IDESourceControlProjectVersion + 111 + IDESourceControlProjectWCCIdentifier + 9E5DC2F442C5D1D821707804A23B5D894E49AF44 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 9E5DC2F442C5D1D821707804A23B5D894E49AF44 + IDESourceControlWCCName + Locksmith + + + + diff --git a/Locksmith.xcodeproj/project.xcworkspace/xcuserdata/matthewpalmer.xcuserdatad/UserInterfaceState.xcuserstate b/Locksmith.xcodeproj/project.xcworkspace/xcuserdata/matthewpalmer.xcuserdatad/UserInterfaceState.xcuserstate index 967992a..eb54f38 100644 Binary files a/Locksmith.xcodeproj/project.xcworkspace/xcuserdata/matthewpalmer.xcuserdatad/UserInterfaceState.xcuserstate and b/Locksmith.xcodeproj/project.xcworkspace/xcuserdata/matthewpalmer.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Locksmith/Locksmith.swift b/Locksmith/Locksmith.swift index a78514a..55e9e97 100644 --- a/Locksmith/Locksmith.swift +++ b/Locksmith/Locksmith.swift @@ -23,7 +23,7 @@ class Locksmith: NSObject { switch type { case .Create: - status = SecItemAdd(requestReference, nil) + status = SecItemAdd(requestReference, &result) case .Read: status = SecItemCopyMatching(requestReference, &result) case .Delete: @@ -37,9 +37,13 @@ class Locksmith: NSObject { let error = Locksmith.keychainError(forCode: statusCode) var resultsDictionary: NSDictionary? - if let data: NSData = result?.takeRetainedValue() as? NSData { - // Convert the retrieved data to a dictionary - resultsDictionary = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? NSDictionary + if let rawValue = result { + if type == .Read { + if let data = rawValue.takeRetainedValue() as? NSData { + // Convert the retrieved data to a dictionary + resultsDictionary = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? NSDictionary + } + } } return (resultsDictionary, error)