vendredi 27 février 2015

RequestResponse nill iam getting

i want to pass this data using api plz help me i want to get countryname id,code,but iam not getting how to do can any one help me thanks in advance.


-(void) getContries { // NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:nil];



// NSString *token=[[NSUserDefaults standardUserDefaults]objectForKey:@"deviceToken"];
NSString *get=[[NSString alloc]initWithFormat:@"&country_id=%@",[self.countryCode text]];

NSLog(@"%@",get);

NSData *postData = [get dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@" http://ift.tt/1N1rk9B"]];
[request setHTTPMethod:@"GET"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:postData];
NSURLResponse *requestResponse;
NSData *requestHandler = [NSURLConnection sendSynchronousRequest:request returningResponse:&requestResponse error:nil];

NSString *requestReply = [[NSString alloc] initWithBytes:[requestHandler bytes] length:[requestHandler length] encoding:NSASCIIStringEncoding];
NSLog(@"requestReply:%@",requestReply);


}




  • (IBAction)countryButton:(id)sender {


    self.countyPicker.hidden=NO; [self getContries];




} error iam getting:


&country_id= 2015-02-28 11:56:27.186 M_CommerceApplication[1111:39838] requestReply:




Aucun commentaire:

Enregistrer un commentaire