首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >iOS:“GPX.Waypoint”不符合“MKAnnotation”协议

iOS:“GPX.Waypoint”不符合“MKAnnotation”协议
EN

Stack Overflow用户
提问于 2015-06-16 15:35:08
回答 1查看 209关注 0票数 0

通过CS193P,我被这个错误困住了。我为什么要犯这个错误?

是什么遗漏了密码?

MKGPX.swift

代码语言:javascript
复制
import MapKit

extension GPX.Waypoint: MKAnnotation
{
    var cooridnate:CLLocationCoordinate2D {
        return CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
    }

    var title:String! { return name }

    var subtitle:String! { return info }
}

点类

代码语言:javascript
复制
class Waypoint: Entry, Printable
    {
        var latitude: Double
        var longitude: Double

        init(latitude: Double, longitude: Double) {
            self.latitude = latitude
            self.longitude = longitude
            super.init()
        }

        var info: String? {
            set { attributes["desc"] = newValue }
            get { return attributes["desc"] }
        }
        lazy var date: NSDate? = self.attributes["time"]?.asGpxDate

        override var description: String {
            return " ".join(["lat=\(latitude)", "lon=\(longitude)", super.description])
        }
    }

MKAnnotation

代码语言:javascript
复制
protocol MKAnnotation : NSObjectProtocol {

    // Center latitude and longitude of the annotation view.
    // The implementation of this property must be KVO compliant.
    var coordinate: CLLocationCoordinate2D { get }

    // Title and subtitle for use by selection UI.
    optional var title: String! { get }
    optional var subtitle: String! { get }
}
EN

Stack Overflow用户

发布于 2015-06-23 12:19:28

只是一个想法,但你是使用SWIFT1.1还是1.2。如果您正在使用1.2Paul发布了新版本的Trax MapKit和Trax用于SWIFT1.2。-> https://web.stanford.edu/class/cs193p/cgi-bin/drupal/

或者您可能在MKGPX.swift中拼错了"var坐标“。

票数 -1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30872099

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档