xcode - Google API key not working - iOS -
i have tried everything. trying request places using google place api. however, receiving request denied. key browser apps works fine if use in ios code, is:
- (ibaction)google:(id)sender { nserror *error; nsstring *lookupstring = [nsstring stringwithformat:@"https://maps.googleapis.com/maps/api/place/search/json?location=-37.849968,145.046310&radius=500&types=food&sensor=true&key=aizasycbg9ursqsxytrf7h9nrg66ers-bhcm9j0"]; lookupstring = [lookupstring stringbyreplacingoccurrencesofstring:@" " withstring:@"+"]; nsdata *jsonresponse = [nsdata datawithcontentsofurl:[nsurl urlwithstring:lookupstring]]; nsstring *newstr = [[nsstring alloc]initwithdata:jsonresponse encoding:nsutf8stringencoding]; nslog(@"locationarray count: %@", newstr); nsdictionary *jsondict = [nsjsonserialization jsonobjectwithdata:jsonresponse options:kniloptions error:&error]; nsarray *locationarray = [[jsondict valueforkey:@"results"]valueforkey:@"formatted_address"]; int total = locationarray.count; nslog(@"locationarray count: %d", locationarray.count); } i have searched everywhere , couldn't find help.
ps1: real key (it test).
ps2: bundle identifies according xcode is: dsg.jsontest (is fine?)
thank help
Comments
Post a Comment