SR_SSLPinnedCertificates is explicitly marked as nullable, and NSURLProtocol setProperty is not. The documentation (header and docs) make no mention of what happens if the property is nil, though most Foundation classes will throw an exception in that case.
Probably the most sensible solution is simply to mark the parameter as not nullable, since it is unclear why you would ever want to set it to nil after setting it to something else (or why you would bother setting it to nil otherwise). But that does not work because the property itself is nullable. So that leaves this:
SR_SSLPinnedCertificates is explicitly marked as nullable, and NSURLProtocol setProperty is not. The documentation (header and docs) make no mention of what happens if the property is nil, though most Foundation classes will throw an exception in that case.
Probably the most sensible solution is simply to mark the parameter as not nullable, since it is unclear why you would ever want to set it to nil after setting it to something else (or why you would bother setting it to nil otherwise). But that does not work because the property itself is nullable. So that leaves this:
(void)setSR_SSLPinnedCertificates:(nullable NSArray )SR_SSLPinnedCertificates { NSArray newSR_SSLPinnedCertificates = [SR_SSLPinnedCertificates copy]; if ( newSR_SSLPinnedCertificates ) { [NSURLProtocol setProperty:newSR_SSLPinnedCertificates forKey:SRSSLPinnnedCertificatesKey inRequest:self];
} else { [NSURLProtocol removePropertyForKey:SRSSLPinnnedCertificatesKey inRequest:self]; } }