KeyClip icon indicating copy to clipboard operation
KeyClip copied to clipboard

KeyClip.load error with Xcode 8

Open siideffect opened this issue 8 years ago • 3 comments

Hello, i was trying to implement this wrapper for keychain, but i definitely got some problem working with swift 3 on the new Xcode 8, when trying to reading a key from the keychain. The problem is related to the (simple) class func load, which gets just the key to perform loading) In terms of code:

//This line produces the error Ambiguous use of 'load(_:failure:)' KeyClip.load("my_key")

Just to let you know, i will try to use the load with closure, as it does not produce any error Thank you for the attention.

siideffect avatar Sep 14 '16 22:09 siideffect

Hello

It should go well when the type is seen to be. It has the same method name is a little regret. :sweat:

let access_token = KeyClip.load("access_token") as String?
let dictionary = KeyClip.load("account") as NSDictionary?
let data = KeyClip.load("data") as Data?

let access_token: String? = KeyClip.load("access_token")
let dictionary: NSDictionary? = KeyClip.load("account")
let data: Data? = KeyClip.load("data")

Thank you

s-aska avatar Sep 15 '16 04:09 s-aska

Seems the type cannot be inferred as you say, cast is not accepted, but the type in the declaration solves it ! Thank you, i learned something new !

siideffect avatar Sep 15 '16 08:09 siideffect

May i ask another thing since i opened this thread?

I am having probleems loading the keys from the keychain. The key gets correctly saved but, even in the same app session(without close) the following code, actually never gets executed. Maybe do i need some particular configuration in my xcode project(like enable capabilities?) ?

if KeyClip.exists("original_transaction_id"){ let originalTransID : String = KeyClip.load("original_transaction_id")! print("Retrieved from keychain ID-->",originalTransID) }

siideffect avatar Sep 15 '16 15:09 siideffect