2009-10-12 11 views
26

Sto utilizzando il tentativo di utilizzare scifihifi-iphone (from Github) per archiviare e recuperare nomi utente e password. Tuttavia, quando aggiungo la classe SFHFKeychainUtils ottengo i seguenti errori:Come si usa il portachiavi Apple?

"_kSecAttrAccount", referenced from: 
     _kSecAttrAccount$non_lazy_ptr in SFHFKeychainUtils.o 
    "_SecItemDelete", referenced from: 
     +[SFHFKeychainUtils deleteItemForUsername:andServiceName:error:] in SFHFKeychainUtils.o 
    "_kSecReturnAttributes", referenced from: 
     _kSecReturnAttributes$non_lazy_ptr in SFHFKeychainUtils.o 
    "_kSecClass", referenced from: 
     _kSecClass$non_lazy_ptr in SFHFKeychainUtils.o 
    "_kSecClassGenericPassword", referenced from: 
     _kSecClassGenericPassword$non_lazy_ptr in SFHFKeychainUtils.o 
    "_SecItemAdd", referenced from: 
     +[SFHFKeychainUtils storeUsername:andPassword:forServiceName:updateExisting:error:] in SFHFKeychainUtils.o 
    "_kSecAttrLabel", referenced from: 
     _kSecAttrLabel$non_lazy_ptr in SFHFKeychainUtils.o 
    "_SecItemUpdate", referenced from: 
     +[SFHFKeychainUtils storeUsername:andPassword:forServiceName:updateExisting:error:] in SFHFKeychainUtils.o 
    "_kSecAttrService", referenced from: 
     _kSecAttrService$non_lazy_ptr in SFHFKeychainUtils.o 
    "_kSecReturnData", referenced from: 
     _kSecReturnData$non_lazy_ptr in SFHFKeychainUtils.o 
    "_SecItemCopyMatching", referenced from: 
     +[SFHFKeychainUtils getPasswordForUsername:andServiceName:error:] in SFHFKeychainUtils.o 
     +[SFHFKeychainUtils getPasswordForUsername:andServiceName:error:] in SFHFKeychainUtils.o 
    "_kSecValueData", referenced from: 
     _kSecValueData$non_lazy_ptr in SFHFKeychainUtils.o 
ld: symbol(s) not found 
collect2: ld returned 1 exit status 

cosa sto lasciando fuori? Quando faccio clic sugli errori, non mi porta in nessun punto del codice.

+0

Sembra un errore del linker. È la prima volta che il tuo codice ha fatto qualcosa con Keychain? –

+0

Hai aggiunto anche il framework Keychain? – jantimon

+0

Come aggiungo il framework Keychain alla mia app? – Jason

risposta

76

Aggiungi Security.framework, quindi ricostruire. A volte trovo che devo costruire pulito e quindi ricostruire.

Per aggiungere questo, fare clic con il tasto destro sulla destinazione in Xcode, quindi Aggiungi-> Framework esistenti e scegliere (o navigare) su Security.framework.

+0

Grazie, è grandioso. Stavo cercando un framework chiamato Keychain.framework che ovviamente non esiste. – Jason

+0

Stucked nello stesso errore, la vostra risposta ha funzionato perfettamente. Grazie –

+1

Questo ha risolto il mio problema, MA ho dovuto trascinare Security.framework nel progetto da Finder, aggiungendolo nella sezione "link con le librerie" di XCode 4.2 non ha funzionato (non sembrava trovare il framework che aveva aggiunto). –