Function Signature Specialization Fails

I receive crash reports from our users, but I did not understand the crash report.

It says:

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

enter image description here

I use fast. What is this report? My method 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")
}

How can I solve it?

+4
source share
2 answers

You need to see what the actual exception is. The most common is the "unexpectedly found nil value when expanding the optional value", which assumes that you are passing String!to the method that was valid nil. But you need to start by looking at the exception message, not just the failure stack.

+1
source

: https://forums.developer.apple.com/thread/6078

, , nil , non-nil.

, : func sendMessage(message: String?,to: String?,anonClosed: String?,toWeb: Int?) , non-nil Objective C

+1

Source: https://habr.com/ru/post/1608050/


All Articles