cuốn sách gpt4 ai đã làm

ios - 使用 componentsSeparatedByString() 断点

In lại Tác giả: Walker 123 更新时间:2023-11-29 02:32:58 32 4
mua khóa gpt4 Nike

我正在为一个应用程序使用 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]

hiện hữu username = annotation.title 行上,它在该行的断点处停止(我已将其关闭)。

 EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)

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

câu trả lời hay nhất

这很可能意味着 annotation hoặc annotation.title 为 nil。我建议在函数体的第一行打断点并检查 annotation tham số.

关于ios - 使用 componentsSeparatedByString() 断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26672711/

32 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress