32 @synthesize data = _data;
35 #pragma mark Connection Delegate
38 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
43 - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
55 - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
57 SecTrustRef serverTrust = [[challenge protectionSpace] serverTrust];
58 NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust];
59 [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
63 #pragma mark Connection Data Delegate
66 - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
68 [
self setResponse:response];
69 [
self setData:[NSMutableData data]];
72 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
74 [[
self data] appendData:data];
77 - (void)connectionDidFinishLoading:(NSURLConnection *)connection