我正在获取当前位置,在我的应用程序中,我想知道我的位置来自 GPS、WIFI 或蜂窝数据。我如何检查? 有没有办法确定位置源?
苹果 iOS 使用
辅助全球定位系统 (A-GPS)
众包 Wi-Fi
蜂窝网络搜索
确定您的位置:
这三个阶段按优先级的降序使用。换句话说,iOS 首先尝试使用 GPS 卫星链接来修复您的位置。如果无法获取卫星,iOS 会故障切换到 Wi-Fi。如果您未连接到 Wi-Fi 局域网 (WLAN),则 iOS 会使用基站数据
有没有办法使用 Google 地图URL 方案在 iOS 上启动具有多个站点的 Google 地图应用程序?
google-maps ios google-maps-sdk-ios swift ios-universal-links
我正在运行一个线程来每10秒获取一次驱动程序位置,并希望从地图中删除添加的标记,但它不起作用..
我的代码:
-(void)APiResponse:(id)returnJson
{
[googleMapsDriverPin setMap:nil];
googleMapsDriverPin = nil;
NSMutableArray *driverPins = [[NSMutableArray alloc]init];
for (int x = 0; x < [[returnJson valueForKey:@"drivers"] count]; x++) {
CLLocation *driverLocations = [[CLLocation alloc]initWithLatitude:[[[[returnJson valueForKey:@"drivers"] objectAtIndex:x] valueForKey:@"driver_latitude"] doubleValue] longitude:[[[[detail valueForKey:@"drivers"] objectAtIndex:x] valueForKey:@"driver_longitude"] doubleValue]];
[driverPins addObject:driverLocations];
}
for (CLLocation *newLocation in driverPins) {
googleMapsDriverPin = [[GMSMarker alloc] init];
[googleMapsDriverPin setPosition:newLocation.coordinate];
[googleMapsDriverPin setAnimated:YES];
[googleMapsDriverPin setTitle:@"title"];
[googleMapsDriverPin setSnippet:@"snippet"];
[googleMapsDriverPin setIcon:[GMSMarker markerImageWithColor:[UIColor blackColor]]];
[googleMapsDriverPin setMap:googleMaps];
}
}
Run Code Online (Sandbox Code Playgroud)
它只是每隔10秒添加和添加而不是删除,请帮忙!谢谢!
我们有一个商业网络应用程序,我们正计划为我们的客户开发Android和iOS应用程序(免费)
谷歌地图ios sdk可以在我的应用程序中免费使用吗?
我们想通过我们的应用程序使用自定义网址方案打开谷歌地图应用程序来显示行车路线.这种方法有任何限制吗?
我正在Xamarin.IOS中编写一个应用程序,它有一个显示Google Maps MapView的控制器,我想在用户点击并保持地图中的任何一点时添加一个标记
到目前为止,我已经尝试将手势识别器添加到MapView对象,但它无法正常工作.这是我的地图控制器代码:
public async override void ViewDidLoad ()
{
base.ViewDidLoad ();
View.BackgroundColor = UIColor.White;
var geolocator = new Geolocator { DesiredAccuracy = 50 };
location = await geolocator.GetPositionAsync (10000);
var camera = CameraPosition.FromCamera (latitude: location.Latitude,
longitude: location.Longitude, zoom: 6);
mapView = MapView.FromCamera (RectangleF.Empty, camera);
mapView.MyLocationEnabled = true;
var longGesture = new UILongPressGestureRecognizer (LongPress);
longGesture.MinimumPressDuration = 2.0;
mapView.AddGestureRecognizer (longGesture);
mapView.StartRendering ();
View = mapView;
}
public override void ViewWillDisappear (bool animated)
{
mapView.StopRendering ();
base.ViewWillDisappear (animated);
}
[Export("LongPress")]
void …Run Code Online (Sandbox Code Playgroud) let stringOFDirection: String = "https://maps.googleapis.com/maps/api/directions/json?origin=23.0723857839751,72.5160750795044&destination=23.057534,72.577191&waypoints=optimize:true|23.0557874,72.465833"
let directionsURL = URL(string: stringOFDirection)!
Run Code Online (Sandbox Code Playgroud)
问题是directionsURL是零
我知道解决方案但是,在这个URL不起作用
请帮我!
我通过解析GeoJSON向我的GMSMapView添加了功能。但是,在弄清楚如何设置此功能样式时,我遇到了极大的麻烦。
当前,该功能是默认的蓝色笔触和半透明的蓝色填充。我想改变这些颜色。我尝试查看了文档,但这是毫无帮助的。我在互联网上可以找到的所有其他问题都与JavaScript API有关。
如何在Google Map上设置特定功能的样式(仅是GeoJSON文件中的样式)?优选地,这将是动态的,但并非必须如此。
我已经成功地从点a到点b绘制了折线,但由于某种原因,它显示的是直线而不是正确的航点
这是代码
let path = GMSMutablePath()
path.addLatitude(3.1970044, longitude:101.7389365)
path.addLatitude(3.2058354, longitude:101.729536)
let polyline = GMSPolyline(path: path)
polyline.strokeWidth = 5.0
polyline.geodesic = true
polyline.map = mapView
Run Code Online (Sandbox Code Playgroud)
我期待它会做一些航点,但它只显示直线折线
ios ×7
swift ×4
google-maps ×3
objective-c ×3
iphone ×2
geojson ×1
json ×1
location ×1
swift4 ×1
xamarin ×1
xamarin.ios ×1