Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Anyone using ObjCBlocks?
-
Has anyone been using ObjCBlocks that take multiple arguments in any APIs? I stumbled across what might be a pythonista bug, but it could easily just as well be my own stupidity.
I have started tackling AudioUnits to experiment with real time audio processing. To that end, I am using
AVAudioEngine
and installing a data tap, which takes a Block of this formhttps://developer.apple.com/reference/avfoundation/avaudionodetapblock?language=objc
typedef void (^AVAudioNodeTapBlock)( AVAudioPCMBuffer *buffer, AVAudioTime *when);
The Python function I tried to use was
def tap(_self, _sel, buffer, when)
however, the proper method seemed to be
def tap(_self, when, buffer, _sel)
In other words, the argument order was backwards, except for the block itself. does the runtime swap arguments on us? Or is pythonista objc_utils doing something funny?
-
Maybe this has something to do with iOS's 64-bit vararg calling conventions being different from normal 64-bit ARM. I think we were discussing that issue on Slack once, when @lukaskollmer tried to get
NSLog
working on a 64-bit device.The only reason I can think of why the argument order is so strange is that maybe
_self
is "early" enough in the list that it's passed as a register, and the rest of the arguments go on the stack, but somehow are in the wrong order?