Note that there are some explanatory texts on larger screens.

plurals
  1. POOpen Url hosted using POST method in Safari using sharedApplication openURL method
    primarykey
    data
    text
    <p>I have a situation in which i am using POST method to host a url in safari browser in simulator. The web page is opened in safari after launching my iOS app in 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:@"https://***some client url***.jsp"]]; NSString *post = [NSString stringWithFormat:@"username=%@&amp;password=%@", userName, password]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; [request setHTTPMethod:@"POST"]; [request setValue:[NSString stringWithFormat:@"%d", [postData length]] forHTTPHeaderField:@"Content-Length"]; [request setHTTPBody:postData];` </code></pre> <p>NSURLConnection* _urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; [_urlConnection start];</p> <p>this piece of code works fine when using UIWebView. But i want to launch Safari using this "request" 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 "request" is of type NSMutableURLRequest. "Semantic Issue: Incompatible pointer types sending 'NSMutableURLRequest *' to parameter of type 'NSURL *" ..</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>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload