On Iphone App start I start a background thread to receive some data from server . where it allows the user to navigate through different views . I have to display an alert when I have a response from server regardless of current view of user . how this can be done ? I think I have to notify my all views on receiving data ? please advise....
Regards
Rizwan
Adding an alert view in connectionDidFinishLoading delegate method is enough as below,
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
UIAlertView *alertBox=[[UIAlertView alloc]initWithTitle:@"Got response" message:@"Loading completed." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertBox show];
[alertBox release];
}
as the alertview will come to the top (works like a local notification).
But you have to make sure that the instance of the class from which you made the web service call and the NSUrlConnection object persists till the connection is finished loading. (not released or deallocated)