Ios SecKeyGetBlockSize(持久对等);导致无法访问

Ios SecKeyGetBlockSize(持久对等);导致无法访问,ios,exc-bad-access,Ios,Exc Bad Access,SecKeyGetBlockSize(持久对等);导致访问错误。我以前没有使用过这个,所以我不确定是什么导致了这个错误 NSData* peerTag = [@"Test PublicKey" dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary * peerPublicKeyAttr = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge id)kSecClassKey, kSec

SecKeyGetBlockSize(持久对等);导致访问错误。我以前没有使用过这个,所以我不确定是什么导致了这个错误

NSData* peerTag = [@"Test PublicKey" dataUsingEncoding:NSUTF8StringEncoding];

NSDictionary * peerPublicKeyAttr = [NSDictionary dictionaryWithObjectsAndKeys:
 (__bridge id)kSecClassKey, kSecClass,
 (__bridge id)kSecAttrKeyTypeRSA, kSecAttrKeyType,
 (__bridge id)kSecAttrKeyClassPublic, kSecAttrKeyClass,
 peerTag, kSecAttrApplicationTag,
 testPubKey, kSecValueData,
 kCFBooleanTrue, kSecReturnPersistentRef,
                                    nil];

OSStatus sanityCheck = noErr;
sanityCheck = SecItemDelete((__bridge CFDictionaryRef) peerPublicKeyAttr);
SecKeyRef persistPeer = NULL;
sanityCheck = SecItemAdd((__bridge CFDictionaryRef)peerPublicKeyAttr, (CFTypeRef *)&persistPeer);


NSData* passwordData = [@"password" dataUsingEncoding:NSUTF8StringEncoding];
NSData* encryptedPass = [[Methods sharedCenter]encrypt:passwordData usingKey:persistPeer];

size_t cipherBufferSize = SecKeyGetBlockSize(persistPeer);