2015-05-06 153 views
0

我想用SSKeychain來保存CFUUID。但有一次,我從SSKeychain得到CFUUID是零...我已經閱讀了關於github的doc,但仍然不知道它有什麼問題。等待救援的〜請~~爲什麼SSKeychain不起作用?

NSString *retrieveuuid = [SSKeychain passwordForService:@"com.game.userinfo "account:@"uuid"]; 
if (retrieveuuid == nil || [retrieveuuid isEqualToString:@""]) 
{ 
    CFUUIDRef uuid = CFUUIDCreate(NULL); 
    assert(uuid != NULL); 
    CFStringRef uuidStr = CFUUIDCreateString(NULL, uuid); 
    retrieveuuid = [NSString stringWithFormat:@"%@", uuidStr]; 
    [SSKeychain setPassword: retrieveuuid 
       forService:@"com.game.userinfo"account:@"uuid"]; 
} 

回答

1

你有設置時,它的第一行(仰視UUID時),但不是在最後一行中"com.game.userinfo "尾隨空格字符。這些字符串應該是相同的。

+0

對於那個愚蠢的錯誤感到羞恥...而Thx很多:) – lx614happy