Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
javascript ValueCallback no funciona en Swift

Tengo este código javascript a continuación que quiero ejecutar rápidamente para extraer html, pero recibí el siguiente error: No se puede encontrar ValueCallback en el alcance.

 view.evaluateJavascript( "(function() { return ('<html>'+document.getElementById('html').innerHTML+'</html>'); })();", new ValueCallback<String>() { @Override public void onReceiveValue(String html) { print(html); } } );
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La función evaluateJavascript tiene una firma diferente

 /* @abstract Evaluates the given JavaScript string. @param javaScriptString The JavaScript string to evaluate. @param completionHandler A block to invoke when script evaluation completes or fails. @discussion The completionHandler is passed the result of the script evaluation or an error. Calling this method is equivalent to calling `evaluateJavaScript:inFrame:inContentWorld:completionHandler:` with: - A `frame` value of `nil` to represent the main frame - A `contentWorld` value of `WKContentWorld.pageWorld` */ open func evaluateJavaScript(_ javaScriptString: String, completionHandler: ((Any?, Error?) -> Void)? = nil)

Tendrías que cambiar tu código a

 view.evaluateJavascript("(function() { return ('<html>'+document.getElementById('html').innerHTML+'</html>'); })();") { value, error in print(value) )
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!