在我手机上直接从 xcode 运行应用程序时,一切运行良好。将其归档并将其作为归档文件运行后,应用程序的行为会有所不同,并且不会按预期运行。这是从存档运行时 asihttprequest 永远不会结束的部分。我会很高兴得到一些帮助。
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker sendEventWithCategory:@"uiAction"
withAction:@"station pressed"
withLabel:@"Station number"
withValue:num];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://server.com/servlet?stationId=%d", [num intValue]]];
__weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
NSLog(@"0");
[request setCompletionBlock:^{
@try {
NSLog(@"1");
StopParser *stop = [[StopParser alloc]init];
NSLog(@"2");
timesArray = [stop getStationsListfromString:[request responseString]];
NSLog(@"3");
[stView.downlodingLabel setHidden:YES];
[stView.downloadingIndicator setHidden:YES];
[stView.tableview reloadData];
[stView.tableview setHidden:NO];
}
@catch (NSException *exception) {
NSLog(@"4");
[stView.downloadingIndicator setHidden:YES];
[stView.downlodingLabel setHidden:NO];
[stView.downlodingLabel setText:@"נא לנסות מאוחר יותר"];
[stView.tableview setHidden:YES];
}
@finally {
[refreshControl endRefreshing];
}
}];
[request setFailedBlock:^{
NSLog(@"5");
[stView.downloadingIndicator setHidden:YES];
[stView.downlodingLabel setHidden:NO];
[stView.downlodingLabel setText:@"נא לנסות מאוחר יותר"];
[stView.tableview setHidden:YES];
[refreshControl endRefreshing];
}];
[request startAsynchronous];