Reputation: 3082
This might be a very silly question. I am parsing 2 URLs in my project,after parsing 1st URL I get userID. Now in 2nd url I need to pass the userID. How I will put the userID in 2nd URL. What i am doing is:-
In viewdidload:-
NSString *str1=[[NSString alloc]initWithFormat:@"http://abc.com/user/%@/bookmarksdata",[arrayList valueForKey:@"userId"]];
NSLog(@"%@",str1);
In connectionDidFinishLoading :- NSString *returnString=[[NSString alloc]initWithData:dataReceived encoding:NSASCIIStringEncoding];
SBJSON *jsonParser=[[SBJSON alloc]init];
NSDictionary *_dict=(NSDictionary *)[jsonParser objectWithString:returnString error:nil];
[arrayListG addObject:[_dict objectForKey:@"userId"]];
NSLog(@"===%@",arrayList);
I am getting userId from my 1st URL, now I want to pass it in given 2nd url. Please help me how to do this..
Upvotes: 0
Views: 145
Reputation: 437
call this function from your connectionDidFinishLoading
[self gettingUrl:[_dict objectForKey:@"userId"]];
after that remove the code from the viewdidLoad.and call the first value in the viewDidload function like this
[self gettingUrl:[arrayList valueForKey:@"userId"]];
add this function
-(void)gettingUrl:(NSString*)userid
{
NSString *str1=[[NSString alloc]initWithFormat:@"http://abc.com/user/%@/bookmarksdata",userid];
NSLog(@"%@",str1);
}
Upvotes: 2