私はiOSプログラミングが初めてです。私の要件は、Google Places のオートコンプリート リクエストをUITextField
. 私は以下のようにコードを書きました
NSString *urlPath = [NSString stringWithFormat:@"/maps/api/place/autocomplete/json?input=%@&types=geocode&language=en-EN&sensor=false",string];
NSURL *url = [[NSURL alloc]initWithScheme:@"http" host:@"maps.googleapis.com" path:urlPath];
NSLog(@"url is:::%@",url);
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]init];
[request setURL:url];
[request setHTTPMethod:@"POST"];
NSURLResponse *response ;
NSError *error;
NSData *data;
data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSLog(@"data is:::%@",data);
NSMutableDictionary *jsonDict= (NSMutableDictionary*)[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSLog(@"jsonDict is:%@",jsonDict);
しかし、それは空になります。どこを間違えたのか教えていただけますか。