i am using ASIHttprequest for login authentication Here is the deme code
The code i am trying is :
[self setRequest:[ASIHTTPRequest requestWithURL:url1]];
[_request setUseKeychainPersistence:[useKeychain isOn]];
[_request setDelegate:self];
[_request setShouldPresentAuthenticationDialog:[useBuiltInDialog isOn]];
[_request setDidFinishSelector:#selector(topSecretFetchComplete:)];
[_request setDidFailSelector:#selector(topSecretFetchFailed:)];
[_request startAsynchronous];
[request setValidatesSecureCertificate:NO];
[_request setValidatesSecureCertificate:NO];
Request failed and Request complete methods
- (IBAction)topSecretFetchFailed:(ASIHTTPRequest *)theRequest{
[responseField setText:[[request error] localizedDescription]];
[responseField setFont:[UIFont boldSystemFontOfSize:12]];
}
- (IBAction)topSecretFetchComplete:(ASIHTTPRequest *)theRequest{
[responseField setText:[request responseString]];
[responseField setFont:[UIFont boldSystemFontOfSize:12]];
NSLog(#"Response :%#",[request responseString]);
}
- (void)authenticationNeededForRequest:(ASIHTTPRequest *)theRequest{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:#"Please Login" message:[request authenticationRealm] delegate:self cancelButtonTitle:#"Cancel" otherButtonTitles:#"OK",nil];
[alertView addTextFieldWithValue:#"" label:#"Username"];
[alertView addTextFieldWithValue:#"" label:#"Password"];
[alertView show];
}
i am new to ios so please......
in this demo when i clock go one alert is popup but when i use my webservice its give the response like this
Response :ASIHTTPRequest: 0xa846400
but do not popup the alertview for enter username and password
If any other Better Way to authenticate login please suggest me
i want to place login as rootview and after successfully login can enter in to app
thanks...
it some times happen when whitespace, special characters and new line characters are in that response so first trim that string and then print the response like bellow..
NSString *strResponse = [[theRequest responseString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(#"Response :%#",strResponse);
UPDATE:
- (NSString *)flattenHTML:(NSString *)html {
NSScanner *theScanner;
NSString *text = nil;
theScanner = [NSScanner scannerWithString:html];
while ([theScanner isAtEnd] == NO) {
[theScanner scanUpToString:#"<" intoString:NULL] ;
[theScanner scanUpToString:#">" intoString:&text] ;
html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:#"%#>", text] withString:#""];
}
//
html = [html stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
return html;
}
use this method like bellow..
NSString *strResponse = [[theRequest responseString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *strFinal = [self flattenHTML:strResponse];
NSLog(#"Response :%#",strFinal);
For Login Authentication ,using ASIFormDataRequest Follow the following STEPS
1) Create one webservice which can match User Name and Password from server and give the response if Username and Password is correct Give response "Success" ELSE "Fail".
For Example : https://www.yoursite.com/login1.php?username=%#&password=%#
2) Create one url using UsernameTextfield.text and PasswordTextfield.text like this
NSURL *url1 = [NSURL URLWithString:[NSString stringWithFormat:#"https://www.yoursite.com/login1.php?username=%#&password=%#",Ustr,Pstr]];
Where Ustr and Pstr are NSString from Both text fields.
3) Create ASIFormDataRequest
- (IBAction)fetchTopSecretInformation:(id)sender{
Ustr = User.text;
Pstr = Pass.text;
NSURL *url1 = [NSURL URLWithString:[NSString stringWithFormat:#"https://www.yoursite.com/login1.php?username=%#&password=%#",Ustr,Pstr]];
ASIFormDataRequest *request1 = [ASIFormDataRequest requestWithURL:url1];
[request1 setUseKeychainPersistence:YES];
request1.delegate = self;
request1.shouldPresentCredentialsBeforeChallenge = YES;
[request1 setRequestMethod:#"POST"];
[request1 setPostValue:User.text forKey:#"User Name"];
[request1 setPostValue:Pass.text forKey:#"Password"];
[request1 setTimeOutSeconds:30];
[request1 setDidFailSelector:#selector(topSecretFetchFailed:)];
[request1 setDidFinishSelector:#selector(topSecretFetchComplete:)];
[request1 startAsynchronous];
}
Connect this method with Sign In Button in xib.
- (IBAction)topSecretFetchFailed:(ASIHTTPRequest *)theRequest{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Error sending request to the server" delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
}
- (IBAction)topSecretFetchComplete:(ASIHTTPRequest *)theRequest{
NSString *strResponse = [[theRequest responseString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
strFinal = [theRequest responseString];
NSLog(#"Sattus Code : %#",[theRequest responseString]);
NSString *failStr = #"failed";
NSString *successStr = #"successfully";
if ([strFinal isEqualToString:successStr]) {
ViewController *view = [[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
[self.navigationController pushViewController:view animated:YES];
}else
if ([strFinal isEqualToString:failStr]) {
UIAlertView *AlertFail = [[UIAlertView alloc] initWithTitle:#"LogIn Failed !" message:#"Wrong ID or Password" delegate:self cancelButtonTitle:#"Ok" otherButtonTitles:nil, nil];
[AlertFail show];
}
}
So if success go to next page otherwise Alert warning .....
Related
So I'm working on creating a login page. But I'm not sure what part I'm missing here! Every time I try to login it says the credentials are invalid.... I'm betting I got confused with POST and GET methods.
Any help would be appreciated! Thanks.
My Code is below:
- (IBAction)login:(id)sender {
if ([userName.text isEqualToString:#""] || [password.text isEqualToString:#""]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Oops!" message:#"Please fill in all the fields!" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alert show];
return;
}
NSURL *url = [NSURL URLWithString:#"http://WEBSITEHERE/api/users/AuthenticateUser"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
NSDictionary *params = #{#"userName": userName.text, #"password": password.text};
NSError *error;
NSData *data = [NSJSONSerialization dataWithJSONObject:params options:0 error:&error];
NSLog(#"PARAMS = %#", params);
[request setHTTPMethod:#"GET"];
[request setValue:#"text/plain" forHTTPHeaderField:#"Accept"];
[request setValue:#"application/json;charset=utf-8" forHTTPHeaderField:#"Content-Type"];
[request setHTTPBody:data];
NSURLResponse *response = nil;
NSData *dataURL = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *result = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];
NSString *responseString = [[NSString alloc]initWithData:dataURL encoding:NSUTF8StringEncoding];
NSLog(#"RESULT = %#", responseString);
if ([result isEqualToString:#"1"])
{
UIStoryboard *mainStoryboard=[UIStoryboard
storyboardWithName:#"MainStoryboard" bundle:nil];
Home *mainView=[mainStoryboard
instantiateViewControllerWithIdentifier:#"mainView"];
mainView.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
[self presentViewController:mainView animated:YES completion:nil];
}else
{
// invalid information
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Oops!" message:#"You must have entered something wrong! Try again!" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alert show];
return;
}
}
I'm not sure how your server is setup but this is how I setup a request for authentication in one of my recent apps:
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:#"%#%#", kBaseServerURL, sAuthMethod]]];
[request setHTTPMethod:#"GET"];
[request setValue:_username forHTTPHeaderField:#"j_username"];
[request setValue:_password forHTTPHeaderField:#"j_password"];
[request setValue:#"application/json" forHTTPHeaderField:#"Accept"];
[request setValue:#"application/json" forHTTPHeaderField:#"Content-Type"];
We can share a message(text) through LinkedIn integration in iPhone Apps. Also, I can share an image Url in LinkedIN ,but Is there any possibility to share a video url through LinkedIn in iPhone Apps......?
Thanks In Advance.....
Use MIS-LinkedIn-Share for sharing url.
Just write following code to share.
- (IBAction)share:(id)sender {
[[MISLinkedinShare sharedInstance] shareContent:self postTitle:#"Title" postDescription:#"Description" postURL:#"http://www.youtube.com/watch?v=_FaWTNEyG80" postImageURL:#"http://www.google.com/images/errors/logo_sm.gif"];
}
don't forget to set api and secret key before sharing.
OR
you can also use method with oAuthStarterkit to share url :-
Here is working code for oAuthStarterKit
1) Open the file OAuthLoginView.m
2) Find the method initLinkedInApi, add your api and secret keys here.
3)Comment lines on viewDidAppear in OAuthLoginView as
- (void)viewDidAppear:(BOOL)animated
{
if ([apikey length] < 64 || [secretkey length] < 64)
{
// UIAlertView *alert = [[UIAlertView alloc]
// initWithTitle: #"OAuth Starter Kit"
// message: #"You must add your apikey and secretkey. See the project file readme.txt"
// delegate: nil
// cancelButtonTitle:#"OK"
// otherButtonTitles:nil];
// [alert show];
// [alert release];
//
// // Notify parent and close this view
// [[NSNotificationCenter defaultCenter]
// postNotificationName:#"loginViewDidFinish"
// object:self
// userInfo:self.profile];
// [self dismissModalViewControllerAnimated:YES];
}
[self requestTokenFromProvider];
}
- (void)shareImp
{
NSLog(#"share Imp called ");
NSURL *url = [NSURL URLWithString:#"http://api.linkedin.com/v1/people/~/shares"];
OAMutableURLRequest *request =[[OAMutableURLRequest alloc] initWithURL:url
consumer:consumer
token:self.accessToken
callback:nil
signatureProvider:nil];
NSMutableDictionary *contents=[[NSMutableDictionary alloc] init];
[contents setValue:#"description goes here" forKey:#"description"];
[contents setValue:#"www.google.com" forKey:#"submitted-url"];
[contents setValue:#"title goes here" forKey:#"title"];
[contents setValue:#"http://economy.blog.ocregister.com/files/2009/01/linkedin-logo.jpg" forKey:#"submitted-image-url"];
NSMutableDictionary *visible=[[NSMutableDictionary alloc] init];
[visible setValue:#"anyone" forKey:#"code"];
NSMutableDictionary *updatedic=[[NSMutableDictionary alloc] init];
[updatedic setObject:visible forKey:#"visibility"];
[updatedic setObject:contents forKey:#"content"];
[updatedic setValue:#"Check out the LinkedIn Share API!" forKey:#"comment"];
NSMutableData *data = [[NSMutableData alloc] init];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
[archiver encodeObject:updatedic forKey:#"share"];
[archiver finishEncoding];
[archiver release];
NSLog(#"post dictionary is %#",updatedic);
NSData *postData=[NSData dataWithData:data];
[request setValue:#"json" forHTTPHeaderField:#"x-li-format"];
[request setValue:#"application/json" forHTTPHeaderField:#"Content-Type"];
[request setValue:[NSString stringWithFormat:#"%d",[postData length]] forHTTPHeaderField:#"Content-Length"];
[request setHTTPBody:postData];
[request setHTTPMethod:#"POST"];
OADataFetcher *fetcher = [[OADataFetcher alloc] init];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:#selector(postUpdateApiCallResult:didFinish:)
didFailSelector:#selector(postUpdateApiCallResult:didFail:)];
[request release];
}
- (void)postUpdateApiCallResult:(OAServiceTicket *)ticket didFinish:(NSData *)data
{
NSLog(#"did finish called ");
NSString *responseBody = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(#"response body after posting is %#",responseBody);
[responseBody release];
[self dismissModalViewControllerAnimated:YES];
}
- (void)postUpdateApiCallResult:(OAServiceTicket *)ticket didFail:(NSData *)error
{
NSLog(#"%#",[error description]);
}
By using Sharekit frame work we are able to post the video URL in LinkedIn.for that we can pass url as a string,
SHKItem *shareItem = [SHKItem text:text];
[SHKLinkedIn shareItem:shareItem];
I'm creating an application that has integration with Twitter .. and wanted to know what have to do to create a button to add an image of the device in the tweet.and also wanted to know which framework to use it and also where the code because my app should be compatible with ios4 too.
First of all is it possible to send image on twitter before ios5?
Yes you can upload image to twitter.
Have a look at this blog article on integrating twitter into your applications; and
This one about adding twitpic to your application to upload images
use sharekit. Refer ShareKit link.
You can use Oauth for this sending.it is compatible with ios4.acct123 is Oauth account
- (IBAction)composeTweet:(id)sender
{
// Build a twitter request
NSString *resultprofileUrl= [NSString stringWithFormat:#"https://api.twitter.com/1/statuses/update.json"];
tweets = [NSMutableArray array];
// Posting image and text to twitpic............
ASIFormDataRequest *req = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:#"http://api.twitpic.com/2/upload.json"]];
[req addRequestHeader:#"X-Auth-Service-Provider" value:#"https://api.twitter.com/1/account/verify_credentials.json"];
[req addRequestHeader:#"X-Verify-Credentials-Authorization"
value:[acct123 oAuthHeaderForMethod:#"GET"
andUrl:#"https://api.twitter.com/1/account/verify_credentials.json"
andParams:nil]];
[req setData:UIImageJPEGRepresentation(imageview3.image, 0.8) forKey:#"media"];
[req setPostValue:#"YourKey" forKey:#"key"];
[req setPostValue:tweetPost.text forKey:#"message"];
[req startSynchronous];
NSLog(#"Got HTTP status code from TwitPic: %d", [req responseStatusCode]);
NSLog(#"Response string: %#", [req responseString]);
NSDictionary *twitpicResponse = [[req responseString] JSONValue];
NSLog(#"image url: %#", twitpicResponse);
url1 = [twitpicResponse valueForKey:#"url"];
NSLog(#"url=%#",url1);
if (url1 == nil) {
url1 = #"";
}
[req release];
NSString *resultUrl = [[NSString alloc]init];
if(reply_tweet_flag != 1)
{
resultUrl = [NSString stringWithFormat:#"%# %#",tweetPost.text,url1];
}
else
{
resultUrl= [NSString stringWithFormat:#"%#",tweetPost.text];
}
NSLog(#"URL>>>>%#",resultUrl);
NSString *postUrl = #"https://api.twitter.com/1/statuses/update.json";
ASIFormDataRequest *request = [[ASIFormDataRequest alloc]
initWithURL:[NSURL URLWithString:postUrl]];
NSMutableDictionary *postInfo = [NSMutableDictionary
dictionaryWithObject:resultUrl
forKey:#"status"];
for (NSString *key in [postInfo allKeys]) {
[request setPostValue:[postInfo objectForKey:key] forKey:key];
}
[request addRequestHeader:#"Authorization"
value:[acct123 oAuthHeaderForMethod:#"POST"
andUrl:postUrl
andParams:postInfo]];
[request startSynchronous];
NSLog(#"Status posted. HTTP result code: %d", request.responseStatusCode);
if (reply_tweet_flag == 1) {
reply_tweet_flag = 0;
[self refresh];
}
if([tweetPost.text isEqualToString:#""])
{
UIAlertView *message1 = [[UIAlertView alloc] initWithTitle:#""
message:#"Check the message"
delegate:self
cancelButtonTitle:#"OK"
otherButtonTitles: nil];
[message1 show];
message1.tag=1;
}
else{
[tweetPost setText:#""];
imageview3.image = [UIImage imageNamed:#""];
UIAlertView *message1 = [[UIAlertView alloc] initWithTitle:#""
message:#"Post was send succesfully"
delegate:self
cancelButtonTitle:#"OK"
otherButtonTitles: nil];
[message1 show];
message1.tag=1;
}
}
I need to upload video from my iphone app to youtube, i have got the access token form google oauth but getting problem while uploading video to youtube, for post request to upload video i am using ASIFormDataRequest. Below is my code, please help me to resolve my mistake, thanks in advance.
- (IBAction)buttonTouched:(id)sender
{
NSLog(#"%d %#",[sender tag],[[NSUserDefaults standardUserDefaults] valueForKey:#"access_token"]);
progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(30, 90, 200, 20.0)];
[alertView addSubview:progressView];
[alertView show];
[progressView setProgress:0];
NSString *name=[videosToShow objectAtIndex:[sender tag]];
NSString *newFilePath = [NSString stringWithFormat:#"%#.mov", [self.path stringByAppendingPathComponent:name]];
NSLog(#"Content URL :%#;", newFilePath);
NSURL *url = [NSURL URLWithString:#"https://uploads.gdata.youtube.com/feeds/api/users/default/uploads"];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setRequestMethod:#"POST"];
NSLog(#"Auth Token== %#",[[NSUserDefaults standardUserDefaults] valueForKey:#"access_token"]);
[request setPostValue:[[NSUserDefaults standardUserDefaults] valueForKey:#"access_token"] forKey:#"authentication_token"];
[request setPostValue:devKey forKey:#"developer_key"];
[request setPostValue:#"abcabc" forKey:#"boundary_string"];
[request setPostValue:devKey forKey:#"content_length"];
NSString *path = [[NSBundle mainBundle] pathForResource:#"xmlcontent" ofType:#"txt"];
NSString *strXml = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[request setPostValue:strXml forKey:#"API_XML_Request"];
[request setPostValue:#"video/mov" forKey:#"video_content_type"];
[request setPostValue:#"video/mov" forKey:#"Binary File Data"];
[request setFile:newFilePath withFileName:#"1.mov" andContentType:#"video/mov" forKey:#"uploaded"];
[request setUploadProgressDelegate:self];
[request setDelegate:self];
[request setDidFinishSelector:#selector(requestFinished:)];
[request setDidFailSelector:#selector(requestFailed:)];
[request setShowAccurateProgress:YES];
[request startAsynchronous];
}
- (void)requestFinished:(ASIFormDataRequest *)request {
[alertView dismissWithClickedButtonIndex:0 animated:YES];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Congrats!!!" message:#"File has been downloaded."
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
- (void)requestFailed:(ASIFormDataRequest *)request1 {
NSError *error = [request1 error];
NSLog(#"%#", error);
}
Below is the file xmlcontent.txt
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
<media:title type="plain">Bad Wedding Toast</media:title>
<media:description type="plain">
I gave a bad toast at my friend's wedding.
</media:description>
<media:category
scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People
</media:category>
<media:keywords>toast, wedding</media:keywords>
</media:group>
</entry>
Below is the error that i am getting
Error Domain=ASIHTTPRequestErrorDomain Code=3 "Authentication needed"
UserInfo=0x1c8ed0 {NSLocalizedDescription=Authentication needed}
You are using the GData library but haven't linked/added it. Check out GData Objective-C Client Setup in XCode 4 on how to build/link the GData library correctly.
I want to know that is there any way I can post picture in twitter with some text, some one has suggested to use "http://tinyurl.com/".I don't know where to start, in my previous application I twit successfully but that only contains text.
A proper direction to proceed would be a great help.
There are a couple of ways. I would suggest you use ShareKit. It does most of the work for you.
To post image to twitter we have to first post the image to twit pick and then we have to send that url to twitter that is the process to send image to twitter this is the sample code to send image to twitter..........
NSString *postUrl = #"https://api.twitter.com/1/statuses/update.json";
ASIFormDataRequest *request = [[ASIFormDataRequest alloc]
initWithURL:[NSURL URLWithString:postUrl]];
NSMutableDictionary *postInfo = [NSMutableDictionary
dictionaryWithObject:statusText.text
forKey:#"status"];
NSLog(#"%#",postInfo);
NSString *str1= statusText.text;
NSLog(#"Status posted. HTTP result code: %d", request.responseStatusCode);
[request release];
[statusText resignFirstResponder];
ASIFormDataRequest *req = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:#"http://api.twitpic.com/2/upload.json"]];
[req addRequestHeader:#"X-Auth-Service-Provider" value:#"https://api.twitter.com/1/account/verify_credentials.json"];
[req addRequestHeader:#"X-Verify-Credentials-Authorization"
value:[oAuth oAuthHeaderForMethod:#"GET"
andUrl:#"https://api.twitter.com/1/account/verify_credentials.json"
andParams:nil]];
[req setData:UIImageJPEGRepresentation(imageView.image, 0.8) forKey:#"media"];
// Define this somewhere or replace with your own key inline right here.
[req setPostValue:#"74734e805f2ad85afae441ca12c16087" forKey:#"key"];
[req startSynchronous];
NSLog(#"Got HTTP status code from TwitPic: %d", [req responseStatusCode]);
NSLog(#"Response string: %#", [req responseString]);
NSDictionary *twitpicResponse = [[req responseString] JSONValue];
NSLog(#"%#",[[req responseString] JSONValue]);
textView.text = [NSString stringWithFormat:#"Posted image URL: %#", [twitpicResponse valueForKey:#"url"]];
NSString *str=[NSString stringWithFormat:#" %#",[twitpicResponse valueForKey:#"url"]];
NSLog(#"%#",str);
if([str isEqualToString:#" (null)"])
{
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:#"Message" message:#"Could not authenticate you(header rejected by twitter)" delegate:self cancelButtonTitle:#"Ok" otherButtonTitles:nil];
[alertView show];
}
else
{
NSString *postUrl = #"https://api.twitter.com/1/statuses/update.json";
ASIFormDataRequest *request = [[ASIFormDataRequest alloc]
initWithURL:[NSURL URLWithString:postUrl]];
NSString *txtmessage=[str1 stringByAppendingString:str];
/*NSMutableDictionary *postInfo = [NSMutableDictionary
dictionaryWithObject:[twitpicResponse valueForKey:#"url"]
forKey:#"status"];*/
NSMutableDictionary *postInfo = [NSMutableDictionary
dictionaryWithObject:txtmessage
forKey:#"status"];
for (NSString *key in [postInfo allKeys]) {
[request setPostValue:[postInfo objectForKey:key] forKey:key];
}
[request addRequestHeader:#"Authorization"
value:[oAuth oAuthHeaderForMethod:#"POST"
andUrl:postUrl
andParams:postInfo]];
[request startSynchronous];
if(request.responseStatusCode!=200)
{
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:#"Message" message:#"Already posted" delegate:self cancelButtonTitle:#"Ok" otherButtonTitles:nil];
[alertView show];
}
else {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:#"Message" message:#"sucess" delegate:self cancelButtonTitle:#"Ok" otherButtonTitles:nil];
[alertView show];
}
NSLog(#"Status posted. HTTP result code: %d", request.responseStatusCode);
statusText.text = #"";
[request release];
[statusText resignFirstResponder];
}