【问题标题】:Breakpoint with componentsSeparatedByString()带有 componentsSeparatedByString() 的断点
【发布时间】:2014-10-31 10:41:37
【问题描述】:

我正在为一个应用使用MapKit

我将信息存储在全局字典中,并再次访问它们。

每个都用 文本 + 用户名 + 日期的键存储。此实例中的用户名变量包含字符串的日期和用户名

func mapView (mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView{
    var pinView = MKPinAnnotationView()
    var imageView: UIImageView = UIImageView()
    var button: UIButton = UIButton()
    let username = annotation.title!.componentsSeparatedByString(" - ")
    var string: String = annotation.subtitle! + username[0] + username[1] as String!
    println(string)
    println(PPs[string])
    var pp = PPs[string]

username = annotation.title 行上,它在此行的断点处停止(我已将其关闭)。

 EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)

我想知道当我声明用户名时出了什么问题,我尝试了 let 和 var。

【问题讨论】:

    标签: ios iphone xcode swift breakpoints


    【解决方案1】:

    这很可能意味着annotationannotation.title 为nil。我建议在函数体的第一行下一个断点并检查annotation参数。

    【讨论】:

    • 谢谢,但这是xcode中的一个错误,错误在错误的行
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-20
    • 1970-01-01
    • 1970-01-01
    • 2013-04-26
    相关资源
    最近更新 更多