In my app i want to display an error message if the network connection is too slow after few seconds. How should i implement this?
Here’s the code:
-(void)setProjectID:(NSString *)newProject {
[self willChangeValueForKey:@"projectID"];
[projectID release];
projectID = [newProject copy];
[self didChangeValueForKey:@"projectID"];
// Since we have an ID, now we need to load it
NSInvocation *returnInvocation = [NSInvocation invocationWithMethodSignature:
[Detail instanceMethodSignatureForSelector:@selector(configureView:)]];
[returnInvocation setTarget:self];
[returnInvocation setSelector:@selector(configureView:)];
[returnInvocation retainArguments];
fetch = [[WBWDocumentFetcher alloc] init];
[fetch retrieveDocument:[NSURL wb_URLForTabType:PROJECT_DETAILS inProject:projectID] returnBy:returnInvocation];
}
-(void)configureView:(NSDictionary *)serverResult
{
}
Thanks,
You want to use
performSelector:afterDelay:or possiblyperformSelector:withObject:afterDelay:.Then, at the beginning of the method called, check to see if the page has loaded. If not, then display a
UIAlertViewand cancel the load.