문제

I have problem to write data to file. What I'm doing wrong?

SecTrustRef trust = [protectionSpace serverTrust];
SecCertificateRef certificate = SecTrustGetCertificateAtIndex(trust, 0);
NSData* ServerCertificateData = (__bridge NSData *)(certificate);
NSError* error;
[ServerCertificateData writeToFile:ServerCertPath options:NSDataWritingAtomic error:&error];
if(error != nil)
     NSLog(@"%@", error);
도움이 되었습니까?

해결책

You can't convert the SecCertificateRef into a NSData * with a cast as you did. You need to use SecCertificateCopyData() on your certificate to get the data out of it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top