From: Axel M. R. <rub...@ro...> - 2008-07-21 21:13:08
|
I have a ruby class that returns some boolean value back to an Obj-C class. However, the values in the obj-C class are all wrong! I have two methods in ruby: def ret_true true end def ret_false false end And I've defined a protocol to call back the Ruby methods from Obj-C @protocol Profiler -(BOOL) ret_true; -(BOOL) ret_false; @end Then, when I call the ruby methods, like this: - (void) testBoolean:(id)testrb { BOOL tst = [testrb ret_true]; NSLog (@"true: %d",tst); tst = [testrb ret_false]; NSLog (@"false: %d",tst); } I get the following output (!) "we're giving a bool to Obj-C" 2008-07-21 23:06:13.763 StringData[19788:10b] true: 0 2008-07-21 23:06:13.767 StringData[19788:10b] false: -8 Thus, true is represented as 0, and false as -8, which is exactly the wrong way around. Am I missing something important here? I've put a Xcode sample package on http://axel.nu/Boolean.zip Hopefully someone can shed some light on the correct bridge behaviour, so I can remove my patch code. Axel -- _________________________ Axel Roest axelloroestello@{AIM/MSN} - Skype:axellofono - XOIP: 084-8749988 |