当我运行我正在构建的gps应用程序时,我会随机获取此信息.它不会每次都发生,传入的坐标总是有效的(我会记录它们).这些地方有文件吗?
编辑:
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(locManager.location.coordinate.latitude, locManager.location.coordinate.longitude);
geocoder1 = [[MKReverseGeocoder alloc] initWithCoordinate:coord];
geocoder1.delegate = self;
[geocoder1 start];
Run Code Online (Sandbox Code Playgroud)
然后大约一半时间它返回错误.如果出现错误,我尝试释放并重新分配地理编码器,但这没有帮助.唯一能做的就是重新启动应用程序.
我正在尝试使用以下网址向Google Places API提出请求:https://maps.googleapis.com/maps/api/place/search/xml? location = 37.77264,0122.409915 & radius = 500 & type = educational %20services&名称=珠穆朗玛峰%20college%20san%20francisco&传感器=假键= YourApiKey
这是我得到的回应:
<PlaceSearchResponse>
<status>REQUEST_DENIED</status>
</PlaceSearchResponse>
Run Code Online (Sandbox Code Playgroud)
知道上面的URL有什么问题吗?
我做到了
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/json?location=30.722322,76.76126&radius=500&types=food&sensor=true&key=any_apiKey"]];
NSURLResponse *response;
NSError *error;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *strResponse = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"%@",strResponse);
SBJSON *sbJason = [[SBJSON alloc] init];
NSMutableDictionary *getPlaceList = [sbJason objectWithString:strResponse];
Run Code Online (Sandbox Code Playgroud)
//但我得到了这个 -
{
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
}
Run Code Online (Sandbox Code Playgroud)
**API Key是否有任何问题我已经写了谷歌地图给出的API密钥.api密钥有什么问题或者请告诉我这里是google api的链接
我正在为我的iOS应用程序使用Google Places API.我已经启用了Google Maps Android API v2,来自API控制台的Places API.在API访问部分创建了一个iOS密钥.我正在使用以下代码向Google Places API提出请求:
NSString *finalString = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json?location=%f,%f&radius=5000&keyword=restaurants&sensor=false&key=PASTE_GENERATED_KEY_HERE",_location.coordinate.latitude,_location.coordinate.longitude];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:finalString]];
Run Code Online (Sandbox Code Playgroud)
但是我在JSON Response中得到了关注
{
"debug_info" = (
);
"html_attributions" = (
);
results = (
);
status = "REQUEST_DENIED";
}
Run Code Online (Sandbox Code Playgroud)
我重新生成了一个不起作用的新密钥.有人可以弄清楚我在这里做错了什么.
自从一天多以来,这个错误一直困扰着我。我已经彻底搜索过,但没有一个答案为我提供解决方案。我已经正确设置了带有应用程序限制的 API 密钥,提供了包名称和 SHA1 密钥。这是代码 manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity android:name=".PlacePickerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
The API key for Google Maps-based APIs is defined as a string resource. …Run Code Online (Sandbox Code Playgroud)