iPhone6以下手機(jī)帝璧,并且iOS 11以后(可能iOS 9以后的系統(tǒng)都有著問(wèn)題,手上沒(méi)有滿(mǎn)足條件的手機(jī)沒(méi)有驗(yàn)證)出現(xiàn)
手機(jī)鎖屏?xí)rRSA加密失敗
出問(wèn)題代碼:
OSStatus status = SecItemAdd((__bridge CFDictionaryRef)publicKey, &persistKey);
if (persistKey != nil){
CFRelease(persistKey);
}
if ((status != noErr) && (status != errSecDuplicateItem)) {
return nil;
}
這里Status = -25308
解決方案:
在構(gòu)造的字典時(shí)羽杰,加以下代碼就解決了
[publicKey setObject:(__bridge id)kSecAttrAccessibleAfterFirstUnlock forKey:(__bridge id)kSecAttrAccessible];
參考文章:
https://stackoverflow.com/questions/9723949/ios-sfhfkeychainutils-failing-sometimes-with-error-25308-errsecinteractionnot