title: Call objective-c method from javascript
body: <p>I make any webView And I want to call from javascript any objective c method which return any parameter. I tried many ways but not allowed . 
  Objective c method here:</p>
  
  <pre><code>- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
  {
      NSURL *URL = [request URL];
      if ([[URL scheme] isEqualToString:@"donordialog"])
      {
          // now we need to figure out the function part
          NSString *functionString = [URL resourceSpecifier];
  
          if ([functionString hasPrefix:@"bloodTypeChanged"])
          {
              // the blood type has changed, now do something about it.
              NSString *parameter = [functionString stringByReplacingOccurrencesOfString:@"bloodTypeChanged" withString:@""];
  
              // remove the '(' and then the ')'
              parameter = [parameter stringByReplacingOccurrencesOfString:@"(" withString:@""];
              parameter = [parameter stringByReplacingOccurrencesOfString:@")" withString:@""];
  
              // log the paramter, as I don't know what to do with it right now
              UIAlertView *alert=[[ UIAlertView alloc] initWithTitle:@"iosdan javascripti"
                                                                             message:@"ddddddddd"
                                                                      delegate:nil
                                                                  cancelButtonTitle:@"OK"
                                                                 otherButtonTitles:nil];
  
              [alert show];
              //NSLog(@"%@", parameter);
          }
  
          return NO;
      }
  
      return YES;
  }
  </code></pre>
  
  <p>javascript:</p>
  
  <pre><code>function myFunction() {
      url="http://example.com";
      window.location="donordialog:blooTypeChanged("+url+")";
  }
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;button onclick="myFunction()"&gt;click me&lt;/button&gt;
  </code></pre>
  
  <p>comment: I need that: it is obj c method for example. aaa{} . My aaa method must return any parameter. and I have wevView. I loaded any url to this webView: for example www.example.com/forios . I need call this (aaa) method from javascript which it is in html on www.example.com/forios and alert the result of aaa function. understand?. If understand, dont watch to my code. help please yourself anyway. 
  android version of my question:<a href="https://stackoverflow.com/questions/10389572/call-java-function-from-javascript-over-android-webview">Call Java function from JavaScript over Android WebView</a>
  I want to alert some parameter returning from method. Help please. Thanks.</p>