How can I pass a JavaScript callback function to Cocoa/Obj-C?

前端 未结 2 1281
予麋鹿
予麋鹿 2021-02-03 15:31

I\'m trying to pass a function reference from JavaScript in a WebView, so my Objective-C code can call then back into that function when the asynchronous Obj-C method completes.

2条回答
  •  醉话见心
    2021-02-03 16:21

    Maybe if it's a global non-anonymous function you can try passing the function name to Obj-C and then evaluating sth like [NSString stringWithFormat:@"%@()", function_name] ?

提交回复
热议问题