search

Home  >  Q&A  >  body text

objective-c - wkwebview js interaction how to add multiple ScriptMessageHandler conveniently and quickly

If there are many interactive methods, it is annoying to add them one by one and have to remove them one by one. Is there any way to solve it with a small amount of code?
When adding an interaction, you need to operate 3 places 1. Write method to implement 2 .Add ScriptMessageHandler 3.Removing it in dealloc is really annoying

I now put those method names into the array, traverse the array to add and remove. Now I need to do two operations: 1. Write the method to implement 2. Throw a method name into the array

I also thought about using runtime to get the method name, but how to identify whether it is a method for js interaction??

高洛峰高洛峰2808 days ago667

reply all(0)I'll reply

No reply
  • Cancelreply