Honey Honey - 2 months ago 11
Swift Question

Why Xcode return error twice?

I'm using Locksmith keychain wrapper.

The method signature is as such:

public static func saveData(data: [String: AnyObject], forUserAccount userAccount: String, inService service: String = LocksmithDefaultService) throws {...}

I'm using it as such:

//Line A—breakpoint
try Locksmith.saveData(["password" : password], forUserAccount: "tech")
catch {
// some code}

At the line of my breakpoint if do

po Locksmith.saveData(["password" : password], forUserAccount: "tech")
I will get



I'm confused as to why am I getting the error twice. Assuming that the error itself is saying Duplicate. I'm more confused. I'm not sure if the issue is because of Locksmith or that I'm not understanding something about how
or something else works in Swift.

PS: I think it would be a good idea if any of the folks that have enough reps, they create an SO tag for
as it's somewhat a popular wrapper for keychain. 1900 people have it starred, I'm sure many more are using it.


I'm running Xcode 8 and Swift3 and Xcode 8 seems a little buggy at this moment.

I'm almost certain that it was a bug. Why?

  • On another run of the app, it was only showing one time.
  • I saw some other errors, printed twice. like I got fatal error: unexpectedly found nil while unwrapping an Optional value 2 times...