-[NSInvocation getReturnValue:] with double value produces 0 unexpectedly

后端 未结 4 569
無奈伤痛
無奈伤痛 2021-02-05 12:22

I am trying to call a method that returns a double using NSInvocation. But I found that it does not working in 64 bit iOS apps. It works on on OS X, in

4条回答
  •  离开以前
    2021-02-05 13:09

    Wow this is still apparently broken today and now in the simulator too (where I'm testing it). I got bit by this bug today, found my double arguments were always coming back zero in the selector of the invocation.

    In my case it was easy to just send it as an NSNumber with @(myDouble) as the argument and then on the other side unwrap it with myNumber.doubleValue

    Nasty.

提交回复
热议问题