title: Open Url hosted using POST method in Safari using sharedApplication openURL method
body: <p>I have a situation in which I am using a POST method to host a URL in the safari browser in the simulator.
  The web page is opened in safari after launching my iOS app in the simulator. To launch safari i have used  [[UIApplication sharedApplication] openURL: ...</p>
  <p>The post method is as follows:</p>
  <pre><code>NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@&quot;https://***some client url***.jsp&quot;]];
  
  NSString *post = [NSString stringWithFormat:@&quot;username=%@&amp;password=%@&quot;, userName, password];
  NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
  [request setHTTPMethod:@&quot;POST&quot;];
  [request setValue:[NSString stringWithFormat:@&quot;%d&quot;, [postData length]] forHTTPHeaderField:@&quot;Content-Length&quot;];
  [request setHTTPBody:postData];`
  
  
  NSURLConnection* _urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
  [_urlConnection start];
  </code></pre>
  <p>this piece of code works fine when using UIWebView. But i want to launch Safari using this &quot;request&quot; which has appended username &amp; password data from the POST method.</p>
  <p>To launch Safari i must call this code:</p>
  <pre><code>[[UIApplication sharedApplication] openURL:request];
  </code></pre>
  <p>But this throws a warning obviously because &quot;request&quot; is of type NSMutableURLRequest.
  &quot;Semantic Issue: Incompatible pointer types sending 'NSMutableURLRequest *' to the parameter of type 'NSURL *&quot;...</p>
  <p>I cannot even use <code>[[UIApplication sharedApplication] openURL:request.URL];</code> since this will give me the URL which is not appended with username &amp; password(with out POST method).</p>
  <p>I want to know how to typecast/convert this request(NSMutableURLRequest) so that I can accommodate it in the [[UIApplication sharedApplication] openURL...</p>
  <p>Hope i am quite clear with my question. Any help will be highly appreciated. Thanks in advance !!</p>