Hi everyone, my app is supposed to make a request from a server every 10 seconds or so with a specific url, change some attributes in the url, and then show the request in another view called "updateView" or if any network error occurred display the error. The first part works fine but if i switch of wifi for example the app crashes. How do i fix this and how do i display the various errors? Thanks in advance!! Here's my code (this is the method which gets called every 10 seconds):
- (void)serverUpdate{
CLLocationCoordinate2D newCoords = self.location.coordinate;
gpsUrl = [NSURL URLWithString:[NSString stringWithFormat:@"http://odgps.de/chris/navextest?objectid=3&latitude=%2.4fN&longitude=%2.4fE&heading=61.56&velocity=5.21&altitude=%f&message=Eisberg+voraus%21", newCoords.latitude, newCoords.longitude, self.location.altitude]];
self.pageData = [NSString stringWithContentsOfURL:gpsUrl];
[updateView.transmissions insertObject:pageData atIndex:counter];
if (counter == 100) {
[updateView.transmissions removeAllObjects];
counter = -1;
}
counter = counter + 1;
[updateView.tableView reloadData];
self.sendToServerSuccessful = self.sendToServerSuccessful + 1;
[self.tableView reloadData];
}