我有這個網址NSURL *url = [NSURL URLWithString:@"http://site.com/ArcGIS/rest/services/POI_Data/MapServer/0/query?&where=ToegangsNr+%3D+5002&returnGeometry=true&outSR=4326&f=json"];
如何把NSUserdefault的價值在URL
但我想用NSUserdefault _phonenumber
改變字符串中的5002值。
我該怎麼做?
此功能的其他代碼是:
ASIHTTPRequest *_request = [ASIHTTPRequest requestWithURL:url];
__weak ASIHTTPRequest *request = _request;
request.requestMethod = @"POST";
[request addRequestHeader:@"Content-Type" value:@"application/json"];
[request appendPostData:[json dataUsingEncoding:NSUTF8StringEncoding]];
// 5
[request setDelegate:self];
[request setCompletionBlock:^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
NSString *responseString = [request responseString];
NSLog(@"Response: %@", responseString);
[self plotCrimePositions:request.responseData];
}];
[request setFailedBlock:^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
NSError *error = [request error];
NSLog(@"Error: %@", error.localizedDescription);
}];