Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li>you use nsmutableurlrequest to generate a web services request</li> <li>use nsuserdefaults to persist the username and password</li> </ol> <p>Here's an example of the first:</p> <pre><code>-(void)sendUpdate { User *user = [User sharedManager]; NSData *parkedLocation = [[NSString stringWithFormat:@"&lt;location&gt;&lt;latitude&gt;%f&lt;/latitude&gt;&lt;longitude&gt;%f&lt;/longitude&gt;&lt;userid&gt;%@&lt;/userid&gt;&lt;udid&gt;%@&lt;/udid&gt;&lt;/location&gt;", coordinate.latitude, coordinate.longitude, userid, user.udid] dataUsingEncoding:NSASCIIStringEncoding]; //NSLog("parkedlocation = %@", parkedLocation); NSString *URLstr = LOCATIONS_URL; if (controller.put_url) URLstr = controller.put_url; NSURL *theURL = [NSURL URLWithString:URLstr]; //NSURLRequest *theRequest = [NSURLRequest requestWithURL:theURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; NSLog(@"IN SEND UPDATE put_url = %@", controller.put_url); NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; if (controller.put_url) { [theRequest setHTTPMethod:@"PUT"]; } else { [theRequest setHTTPMethod:@"POST"]; } [theRequest setValue:@"text/xml" forHTTPHeaderField:@"Content-type"]; [theRequest setHTTPBody:parkedLocation]; [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:TRUE]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (!theConnection) { NSLog(@"COuldn't get a connection to the iParkNow! server"); } } </code></pre> <p>and an example of the second:</p> <pre><code> [[NSUserDefaults standardUserDefaults] setObject:self.userName.text forKey:@"Username"]; [[NSUserDefaults standardUserDefaults] setObject:self.password.text forKey:@"Password"]; </code></pre>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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