omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    Invoking an NsBlock

    Pythonista
    2
    3
    2587
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JonB
      JonB last edited by

      Has anyone had success invoking an NSBlock? I have a python objc class that i have crated, which is accepting an ObjCBlock as an argument. The Block takes two arguments, and integer and a pointer (to the objc equivalent of a list). (This is the completion arg of for a PA2ConsoleCompletionProvider )

      However, when calling ObjCInstance on the pointer, it returns an NSBlock. This has a method invoke(), but it does not want to take arguments. I feel like I have ben able to do this before, but I have forgotton how!

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        To be clear -- the block i want to call is one provided to me, not one i created.

        1 Reply Last reply Reply Quote 0
        • dgelessus
          dgelessus last edited by

          I don't know how well the invoke method works... I think the proper way to invoke a block is to read it as a structure pointer (see http://clang.llvm.org/docs/Block-ABI-Apple.html for the struct format), take the invoke function pointer from there, cast it to the correct signature, and then call that.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors