小编rsc*_*101的帖子

CLLocationCooperative2D 放入一个数组

我在地图套件上绘制了动态数量的位置。我很好奇如何将当前的纬度和经度放入单个数组中,因为它们当前被打印为单独的对象,而没有像应有的那样绘制地图。我知道问题所在,但不知道如何解决。这是我当前生成坐标的代码 -

  do {
        let place = try myContext.executeFetchRequest(fetchRequest) as! [Places]

        for coords in place{
            let latarray = Double(coords.latitude!)
            let lonarray = Double(coords.longitude!)
            let arraytitles = coords.title!

            let destination:CLLocationCoordinate2D = CLLocationCoordinate2DMake(latarray, lonarray)

        print(destination)

    } catch let error as NSError {
        // failure
        print("Fetch failed: \(error.localizedDescription)")
    }
Run Code Online (Sandbox Code Playgroud)

这是控制台中的打印 - 输出

我需要什么才能使打印看起来正常工作 -所需的输出

我希望你明白我的意思。我非常感谢任何帮助!感谢您的阅读。

dictionary coordinates mapkit cllocationcoordinate2d swift

4
推荐指数
1
解决办法
3622
查看次数