AppDelegate has a parameter called user,
and user has two parameters called userId & departmentId.
I just want to access my WebService use the ASIHttpRequest API,
but before I send the request,
there is error EXC_BAD_ACCESS with in this code:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
NSString *userId = appDelegate.user.userId;
NSString *departmentId = appDelegate.user.departmentId;
NSLog(@"xxxxx:%@",userId);//this can log 29
NSLog(@"xxxxx:%@",departmentId);//this can log 17
NSString *URL = [NSString stringWithFormat:@"https://xxx.xxx.xx.xx/FMS/Pages/Service/FMService.svc/GetAnnouncement?userId=%@&departmentId=%@&pageIndex=%@&pageSize=%@",userId,departmentId,1,10]; ***//ERROR***
The userId’s value is 29 and the departmentId’s value is 17,
then I change code to:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://xxx.xxx.xx.xx/FMS/Pages/Service/FMService.svc/GetAnnouncement?userId=%@&departmentId=%@&pageIndex=%@&pageSize=%@",userId,departmentId,1,10]];//also the same error
There is also the same error…
and I dont know why, so pls help me with this, thank you.
The last two argument to
stringWithFormat:are not objects therefore you should not use the format specifier%@instead use%d