Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8369879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:46:11+00:00 2026-06-09T13:46:11+00:00

I am migrating my app from android to iOS and for following line, compiler

  • 0

I am migrating my app from android to iOS and for following line, compiler returns me an error on iOS,

webviewA.loadUrl("javascript:setVars(\"" + var1 + "\",\"" + var2 + "\")"); //properly executed on Android

for iOS I am trying,

[webViewA stringByEvaluatingJavaScriptFromString:@"javascript:setVars(\"" + var1 + "\",\""  + var2 +  "\")"];

which would be correct syntax for iOS? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:46:12+00:00Added an answer on June 9, 2026 at 1:46 pm

    As per this answer on another similar question, you need to implement the UIWebView delegate method webViewDidFinishLoad:, and in there implement [myWebView stringByEvaluatingJavaScriptFromString:@"myJavaScriptCode()"].

    In order for this to work you need to set the delegate on the UIWebView instance and implement the delegate method mentioned above so that the JavaScript is executed after the page has loaded.

    The documentation for - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script can be found here.

    Now for the other part of your question (thanks for clarifying!).. to concatenate strings in Objective-C you can use the NSString class method stringWithFormat:.

    For example, to pass two Objective-C values to a JavaScript string, you could do something like this:

    // Substitute your Objective-C values into the string
    NSString *javaScript = [NSString stringWithFormat:@"setVars('%@', '%@')", var1, var2, nil];
    
    // Make the UIWebView method call
    NSString *response = [webViewA stringByEvaluatingJavaScriptFromString:javaScript];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm migrating an iOS app to Android. This iOs app uses types like uint32_t.
I have an iOS app that I'm migrating from the very slow and clunky
I'm migrating my app from MySQL to Postgres. If I do a rake db:schema:load
We've got a weird problem while migrating our app from 1.3.7 to 2.0.0. Our
So, we are migrating an old web app from a 32-bit server to a
I am thinking of migrating my GWT app from native GWT to GXT, however
I'm migrating a web app from an IIS 6 server to an IIS 7
I'm currently migrating a working app from CakePHP 1.2 to 1.3. Most things seem
We are in the process of migrating an app to .NET 4.0 (from 3.5).
I am in progress of migrating an app from CakePHP 1.3 to 2.0, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.