我的 java webservice 中有一个方法,它接受参数并运行 sql 查询来更新数据库。参数当然是从 iphone 插入到 URL 中,当 url 执行时它会调用 webservice 方法来更新数据库。我的问题是,如何在 ios 中执行 URL 但不打开 safari 或其他任何东西。这里是代码:
-(void)updateInfo
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Updating Profile" message:@"Your data have been saved." delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert setTag:02];
[alert show];
}
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
GlobalObjects *global = [[GlobalObjects alloc]init];
NSString *url =[NSString stringWithFormat:@"%@/profile/login/update/%@/%@/%@/%@/%@/%@/%@",global.domain,self.user, self.firstName.text,self.address.text,self.city.text,self.country.text,self.zipCode.text,self.phone.text];
if (alertView.tag == 02 && buttonIndex != alertView.cancelButtonIndex) {
// The URL execution method should come here.
}
}