Created
March 3, 2010 01:57
-
-
Save vkoser/320218 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dataStr is a base64 encoded username and password in format username:password | |
| NSMutableString *dataStr = @"Basic dXNlcm5hbWU6cGFzc3dvcmQ="; | |
| // Set up the URL | |
| NSMutableURLRequest * request=(NSMutableURLRequest*)[NSMutableURLRequest requestWithURL:[NSURL URLWithString:theURL] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:1.0]; | |
| // append the http header for authentication | |
| [request addValue:dataStr forHTTPHeaderField:@"Authorization"]; | |
| // Send the request to the web service | |
| NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment