标签: mapkit

在iOS6中为MKMapKit路由数据

我以前在iOS应用程序中做过路由,但是对于iOS6,我们现在正在显示Apple地图 - 这会导致问题,因为我们使用Google路由数据,如果我们使用Google数据,我们应该在Google地图上显示它.

我一直在搜索,但据我所知,Apple没有提供任何路由数据.到目前为止,答案最接近答案似乎是苹果公司说Apps that consume direction information do so by sending an appropriate request to the Maps app, which then handles the task of displaying that information to the user.- 对我而言,这意味着地图应用程序将被打开以显示路线,并将用户从我们的应用程序中取出.

  • 我们在哪里可以获得使用Apple地图在iOS6应用程序上使用的即时路由数据?

mapkit ios ios6 ios6-maps

3
推荐指数
2
解决办法
3124
查看次数

会员访问不完整类型'CALayer'

对于以下代码:

CGRect frame = CGRectMake(0, 0, cellWidth, 240);
MKMapView *mapView = [[MKMapView alloc] initWithFrame:frame];

mapView.layer.masksToBounds = YES;     
mapView.layer.cornerRadius = 10.0;
Run Code Online (Sandbox Code Playgroud)

我还包括MapKit,QuartzCore和CoreLocation框架.对于最后两行,我收到错误:"成员访问不完整类型'CALayer'"

请告诉我为什么我会收到此错误以及如何解决此问题

编辑:我得到这个错误,因为我没有导入Quartz.h,但我仍然不明白为什么它说CALayer类型的不完整性.任何人都可以深入了解这一点.

谢谢

calayer mapkit ios

3
推荐指数
1
解决办法
4570
查看次数

拖动时获取MKAnnotation的坐标

我正在根据用户添加的注释位置创建路径(MKPolyline).我想允许用户通过拖动引脚来更改路径.我目前可以这样做,但MKPolyline在引脚掉线之前不会更新.

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annotationView didChangeDragState:(MKAnnotationViewDragState)newState fromOldState:(MKAnnotationViewDragState)oldState为此实现MKAnnotationViewDragStateDragging但它只提醒我用户正在拖动引脚而不是关于新位置的通知.

每次更改时,如何获取注释的当前位置?我希望在拖动时通知有关位置的任何变化,以便能够更新MKPolyline以跟随引脚移动,以更好地反映路径的变化.

有任何想法吗?谢谢!

iphone objective-c mapkit

3
推荐指数
1
解决办法
1335
查看次数

如何在CLI生成的phonegap应用程序中使用plugman插件

我刚开始使用新的Phonegap应用程序和一些测试.我想使用MapKit -Plugin https://github.com/imhotep/MapKit.

我创建了一个新的应用程序phonegap create Test.

下一步:

cd Test
phonegap build ios
phonegap build android
plugman --platform android \
    --project . \
    --plugin https://github.com/imhotep/MapKit.git \
    --variable API_KEY="xxxxx"

Error: ENOENT, no such file or directory '/Users/User/Entwicklung/2.0/prototypes/Test/AndroidManifest.xml'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.openSync (/usr/local/Cellar/node/0.10.3/lib/node_modules/plugman/node_modules/glob/node_modules/graceful-fs/graceful-fs.js:68:26)
at Object.fs.readFileSync (fs.js:284:15)
at Object.module.exports.parseElementtreeSync (/usr/local/Cellar/node/0.10.3/lib/node_modules/plugman/src/util/xml-helpers.js:144:27)
at androidPackageName (/usr/local/Cellar/node/0.10.3/lib/node_modules/plugman/src/platforms/android.js:131:28)
at handlePlugin (/usr/local/Cellar/node/0.10.3/lib/node_modules/plugman/src/platforms/android.js:41:24)
at Object.module.exports.install (/usr/local/Cellar/node/0.10.3/lib/node_modules/plugman/src/platforms/android.js:30:9)
at runInstall (/usr/local/Cellar/node/0.10.3/lib/node_modules/plugman/src/install.js:110:13)
at /usr/local/Cellar/node/0.10.3/lib/node_modules/plugman/src/install.js:28:17
at /usr/local/Cellar/node/0.10.3/lib/node_modules/plugman/src/util/plugins.js:105:31
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

谢谢!

command-line-interface mapkit cordova

3
推荐指数
1
解决办法
3746
查看次数

Swift MKPointAnnotation自定义图像

我尝试在swift中为我的MKPointAnnotation创建一个自定义的"badget",但它失败了,因为MKPointAnnotation没有像图像那样的任何属性

 var information = MKPointAnnotation()
    information.coordinate = location 
    information.title = "Test Title!"
    information.subtitle = "Subtitle"
    information.image = UIImage(named: "dot.png") //this is the line whats wrong
    Map.addAnnotation(information)
Run Code Online (Sandbox Code Playgroud)

有人想出了一个快速的解决方案吗?

mapkit ios mkpointannotation swift

3
推荐指数
1
解决办法
9415
查看次数

使用Swift以编程方式在Mapkit中倾斜地图

我想在启动时倾斜地图.(与用户用2个手指向上或向下滚动时相同)

这可能使用Swift吗?

mapkit ios swift

3
推荐指数
2
解决办法
3828
查看次数

确定MKRoutestep何时完成

我正在尝试使用MKDirections API在iOS中实现转弯导航系统.我可以获取路线的方向并可以在地图上绘制折线,当导航开始时,应用程序开始使用步骤数组中的MKRouteStep对象显示指令.现在的问题是,由于MKRouteStep对象中的距离是用户在遍历步骤路径时所覆盖的距离,因此我无法确定如何计算此距离.有没有办法计算这个距离目前我正在计算两个坐标之间的距离,即最后一条指令显示的坐标与用户的当前位置,以及该距离是否等于MKRouteStep中提到的距离我正在显示下一条指令,因为它正在延迟指令交付给用户.

如果有任何方法可以识别此MKRouteStep结束的坐标或区域,我可以计算用户是否在该区域,然后显示下一条指令.也许这可以起作用你的想法,但为此我怎么知道这个MKRouteStep从MKRouteStep的折线数组结束的坐标或区域?

请建议是否有任何其他好的解决方案.任何帮助都非常感谢.

谢谢.

navigation mapkit ios directions mkpolyline

3
推荐指数
1
解决办法
535
查看次数

错误:无法将类型NSKVONotifying_MKUserLocation的值强制转换为Park_View.AttractionAnnotation

使用此功能时:

func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {
    let annotationView = AttractionAnnotationView(annotation: annotation, reuseIdentifier: "Attraction")
    annotationView.canShowCallout = true
    return annotationView
}
Run Code Online (Sandbox Code Playgroud)

发生此错误:

无法将'NSKVONotifying_MKUserLocation'(0x7e8a62b0)类型的值转换为'Park_View.AttractionAnnotation'(0xf7948).

它运行良好,但当我尝试添加CoreLocation以查找我的代码的用户位置时,我开始出现此错误.

core-location mapkit mkannotation swift

3
推荐指数
1
解决办法
2188
查看次数

如何在Mapkit Swift中随意放置注释

我想知道如何在MapView中随机地固定15个注释

    let latitude: CLLocationDegrees = 33.606800
    let longitude: CLLocationDegrees = -111.845360
    let location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)

    //map annotation
    let annotation = MKPointAnnotation()
    annotation.coordinate = location
    annotation.title = "Taliesin West"
    annotation.subtitle = "Design"
    map.addAnnotation(annotation) 
Run Code Online (Sandbox Code Playgroud)

xcode mapkit ios swift

3
推荐指数
1
解决办法
1740
查看次数

Transit MKDirectionsRequest产生空错误Error Domain = MKErrorDomain Code = 5“(null)”

我正在尝试使用MapKit方向请求获取两个坐标之间的公交路线。

当我切换到其他类型(非Transit)时,下面的代码有效,但是当我切换到Transit时,它将引发一个错误,该错误在Apple文档中没有显示。

这两个位置(来源和目的地)都在纽约市,因此绝对应该有可用的公交路线。

错误信息:

Error Domain=MKErrorDomain Code=5 "(null)"
Run Code Online (Sandbox Code Playgroud)

程式码片段:

override func viewDidLoad() {
    super.viewDidLoad()

    let request = MKDirectionsRequest()

    // Set request parameters
    request.source = MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: 40.7127, longitude: -74.0059), addressDictionary: nil))
    request.destination = MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: 40.6761, longitude: -73.9521), addressDictionary: nil))
    request.requestsAlternateRoutes = true

    // Set tranport type parameter (anything other than .Transit works)
     request.transportType = .Transit

    let directions = MKDirections(request: request)

    directions.calculateDirectionsWithCompletionHandler { response, error in
        print(response)

        guard let routes = response?.routes else {
            print(error?.description)
            return
        }

        // …
Run Code Online (Sandbox Code Playgroud)

mapkit ios swift

3
推荐指数
1
解决办法
1187
查看次数