अधिकतर एक मामूली मामला है लेकिन क्या पूरा होने वाला ब्लॉक हमेशा [NSURLConnection sendAsynchronousRequest: ...]
का उपयोग करके बुलाया जाएगा? या मुझे टाइमआउट टाइमर लागू करना है?क्या [NSURLConnection sendAsynchronousRequest: ...] हमेशा समापन ब्लॉक भेज देगा?
[self showHUDWithTitle:@"Configuring"];
[NSURLConnection sendAsynchronousRequest:request
queue:[[NSOperationQueue alloc] init]
completionHandler:^(NSURLResponse *response,
NSData *data,
NSError *error) {
if ([data length] >0 && error == nil) {
[self hideHUDWithFlag:YES
andTitle:@"Finished"
andSubtitle:@"(Box was configured)"];
} else if ([data length] == 0 && error == nil) {
[self hideHUDWithFlag:NO
andTitle:@"Failed"
andSubtitle:@"(Check box connection)"];
NSLog(@"Nothing was downloaded.");
} else if (error != nil) {
[self hideHUDWithFlag:NO
andTitle:@"Error"
andSubtitle:@"(Check box connection)"];
NSLog(@"Error = %@", error);
}
}];
स्वाभाविक रूप से। एक समापन हैंडलर एक पूर्ण हैंडलर है - सफलतापूर्वक हैंडलर नहीं: डी –
@ दाईज-दंजन मैं सफलता हैंडलर हूं, पूरा पूरा करने वाला पूरा नहीं! – Groot
अगर (! त्रुटि) = सफलता: डी –