我收到了用户的崩溃报告,但我不了解崩溃报告.
它说:
Ribony: function signature specialization <Arg[0] = Owned To Guaranteed and Exploded, Arg[1] = Owned To Guaranteed and Exploded, Arg[2] = Owned To Guaranteed and Exploded, Arg[3] = Exploded, Arg[4] = Owned To Guaranteed> of Ribony.ChatManager.sendMessage (Ribony.ChatManager)(Swift.String, to : Swift.String, anonClosed : Swift.String, toWeb : Swift.Int) -> () + 3608
Run Code Online (Sandbox Code Playgroud)
我正在使用swift.这是什么报告?我的sendMessage方法:
func sendMessage(message: String,to: String,anonClosed: String,toWeb: Int) {
NSNotificationCenter.defaultCenter().postNotificationName(mySpecialNotificationKey, object: self,userInfo:["message":message])
var sender=""
var token=""
var toSubstr=""
if count(to) >= 5 {
let rangeOfTo = Range(start: to.startIndex,
end: advance(to.startIndex, 5))
toSubstr = to.substringWithRange(rangeOfTo)
}else{
toSubstr=to
}
socket.emit("sendMessage","ok")
}
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
您需要查看实际的异常是什么。最常见的是“在展开可选值时意外发现 nil”,这表明您将 a 传递String!给了这个方法,这实际上是nil. 但您需要首先查看异常消息,而不仅仅是崩溃堆栈。