How can I create a Login Page in Xcode? - iphone

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"];

Related

How to post data through json in iOS

I have attempted to post data into server through json. Suppose i have just one field named username into my xib. Now i am posting this data into server. I have written this code
NSString *uname=txt_name.text;
NSMutableURLRequest *request =[[NSMutableURLRequest alloc] initWithURL:
[NSURL URLWithString:#"http://mypath/index.php?params=123"]];
[request setHTTPMethod:#"POST"];
// NSString *postString = #"Email=me#test.com";
[request setValue:[NSString
stringWithFormat:#"%d", [uname length]]
forHTTPHeaderField:#"Content-length"];
[request setHTTPBody:[uname
dataUsingEncoding:NSUTF8StringEncoding]];
[[NSURLConnection alloc]
initWithRequest:request delegate:self];
NSLog(#"text",uname);
But i do not know the data is posting or not. I want to post my input data into console of in Xcode but there nothing is showing. What the reason..? Whats wrong is going on..?
You need the following request:
NSDictionary *dataDict = #{#"uname": <YOUR_UNAME>};
NSData *postData = [NSJSONSerialization dataWithJSONObject:dataDict options:0 error:nil];
NSMutableURLRequest *request =[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:#"http://mypath/index.php?params=123"]];
[request setHTTPMethod:#"POST"];
[request setHTTPBody:postData];
[request setValue:[NSString stringWithFormat:#"%d",postData.length] forHTTPHeaderField:#"Content-Length"];
[request setValue:#"application/json; charset=utf-8" forHTTPHeaderField:#"Content-Type"];
To ensure the server have got your data use
- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
NSInteger statusCode = httpResponse.statusCode;
...........
}
In case of success you will get statusCode = 200.
NSString *string= [NSString stringWithFormat:#"your Url.php?&Username=%#",username];
NSLog(#"%#",string);
NSURL *url = [NSURL URLWithString:string];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:#"POST"];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(#"responseData: %#", responseData);
NSString *str = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(#"responseData: %#", str);
NSString *str1 = #"1";
if ([str isEqualToString:str1 ])
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:#"Successfully" message:#"" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil, nil];
[alert show];
}
else
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:#"Try Again" message:#"" delegate:self cancelButtonTitle:#"Try Later" otherButtonTitles:#"Call", nil];
alert.tag = 1;
[alert show];
}
Don't need to use JSON you can do this without JSON in a esay way!!!

using HTTP Post method how to make login page in iphone

I'm have created a Login view. Everytime I login it gives me login Success message will be displayed. even if I enter wrong username and password.I am created login page static.The menctioned link is sample web services link. This is the method I'm using right now:Please give me any idea.Thanks in advance.
loginPage.m
-
(IBAction)login:(id)sender
{
NSString *post = [NSString stringWithFormat:#"&Username=%#&Password=%#",#"username",#"password"];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:#"%d",[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:#"HTTP://URL"]]];
[request setHTTPMethod:#"POST"];
[request setValue:postLength forHTTPHeaderField:#"Content-Length"];
[request setValue:#"application/x-www-form-urlencoded" forHTTPHeaderField:#"Current-Type"];
[request setHTTPBody:postData];
NSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:request delegate:self];
if (conn)
{
NSLog(#"connection successful");
}
else
{
NSLog(#"Failed");
}
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
}
-(void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[receivedData setLength:0];
// NSURL *theURL=[response URL];
}
-(void) connectionDidFinishLoading:(NSURLConnection *)connection
{
if(receivedData)
{
NSLog(#"success",[receivedData length]);
}
else
{
NSLog(#"Success",[receivedData length]);
}
}
NSString *string= [NSString stringWithFormat:#"your Url.php?&Username=%#&Password=%#",username,password];
NSLog(#"%#",string);
NSURL *url = [NSURL URLWithString:string];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:#"POST"];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(#"responseData: %#", responseData);
NSString *str = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(#"responseData: %#", str);
NSString *str1 = #"1";
if ([str isEqualToString:str1 ])
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:#"Successfully" message:#"" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil, nil];
[alert show];
}
else
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:#"Try Again" message:#"" delegate:self cancelButtonTitle:#"Try Later" otherButtonTitles:#"Call", nil];
alert.tag = 1;
[alert show];
}
Don't need to use JSON you can do this without JSON in a esay way!!!
- (void) alertStatus:(NSString *)msg :(NSString *)title
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
message:msg
delegate:self
cancelButtonTitle:#"Ok"
otherButtonTitles:nil, nil];
[alertView show];
}
- (IBAction)loginClicked:(id)sender {
#try {
if([[txtUserName text] isEqualToString:#""] || [[txtPassword text] isEqualToString:#""] ) {
[self alertStatus:#"Пожалуйста заполните все поля!!!" :#"Авторизация не удолась!"];
} else {
NSString *post =[[NSString alloc] initWithFormat:#"login=%#&pass=%#",[txtUserName text],[txtPassword text]];
NSURL *url=[NSURL URLWithString:#"http:xxxxxxxx.xxx/?"];
NSData *postData = [post dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:#"%lu", (unsigned long)[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:url];
[request setHTTPMethod:#"POST"];
[request setValue:postLength forHTTPHeaderField:#"Content-Length"];
[request setValue:#"application/json" forHTTPHeaderField:#"Accept"];
[request setValue:#"application/x-www-form-urlencoded" forHTTPHeaderField:#"Content-Type"];
[request setHTTPBody:postData];
NSError *error = [[NSError alloc] init];
NSHTTPURLResponse *response = nil;
NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if ([response statusCode] >=200 && [response statusCode] <300)
{
NSData *responseData = [[NSData alloc]initWithData:urlData];
NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:nil];
if([jsonObject objectForKey:#"error"])
{
[self alertStatus:#"" :#""];
} else {
[self alertStatus:#"" :#""];
}
} else {
if (error) NSLog(#"Error: %#", error);
[self alertStatus:#"Connection Failed" :#"Login Failed!"];
}
}
}
#catch (NSException * e) {
NSLog(#"Exception: %#", e);
[self alertStatus:#"Login Failed." :#"Login Failed!"];
}
[txtUserName resignFirstResponder];
[txtPassword resignFirstResponder];
}
Try below code.
-(void)webservice_Call
{
NSString *urlString=#"http://api.openweathermap.org/data/2.1/find/city?lat=10.369&lon=122.5896";
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:10];
[request setHTTPMethod: #"GET"];
NSError *requestError;
NSURLResponse *urlResponse = nil;
NSData *response1 = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&requestError];
NSDictionary *resDictionary = [NSJSONSerialization JSONObjectWithData:response1 options:NSJSONReadingMutableContainers error:Nil];
}
Post Method for iOS 9 Version
NSMutableDictionary *post = [[NSMutableDictionary alloc]init];
   
[post setValue:#“25” forKey:#"user_id"];
NSArray* notifications = [NSArray arrayWithObjects:post, nil];
       
NSError *writeError = nil;
       
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:notifications options:kNilOptions error:&writeError];
       
NSString *postLength = [NSString stringWithFormat:#"%d",[jsonData length]];
       
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]init];
      
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:#"http://your/url]]];
      
[request setHTTPMethod:#"POST"];
      
[request setValue:postLength forHTTPHeaderField:#"Content-Length" ];
      
[request setValue:#"application/json" forHTTPHeaderField:#"Accept"];
      
[request setValue:#"application/json" forHTTPHeaderField:#"Content-Type"];
      
[request setHTTPBody:jsonData];
      
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
 
// Create a data task object to perform the data downloading.
    
NSURLSessionDataTask *task = [session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
 
    data = [[NSData alloc]initWithData:urlData];
    NSMutableDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
}];
      
[task resume];
-(void)apiCode
{
NSString *string= [NSString stringWithFormat:#"http:url...project_id=1&user_id=58&question=%#&send_enquiry=%#",self.txtTitle.text,self.txtQuestion.text];
NSLog(#"%#",string);
NSURL *url = [NSURL URLWithString:string];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:#"POST"];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(#"responseData: %#", responseData);
NSString *str = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(#"responseData: %#", str);
NSString *str1 = #"success";
if ([str isEqualToString:str1 ])
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:#"Successfully" message:#"" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil, nil];
[alert show];
}
else
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:#"Try Again" message:#"" delegate:self cancelButtonTitle:#"Try Later" otherButtonTitles:#"Call", nil];
alert.tag = 1;
[alert show];
}
}

Connect iphone app to mysql data base

I have app i want to connect to iphone app i have done code and also php code problem is that i am always getting Incorrect password alert view . I aam entering correct user name and password but again it displays error alert view
NSString *post =[NSString stringWithFormat:#"UserName=%#&UserPassword=%#",userNameTextField.text, userPasswordTextFiled.text];
NSString *hostStr = #"http://www.myurl.com/emrapp/connect.php?";
hostStr = [hostStr stringByAppendingString:post];
NSData *dataURL = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
if([serverOutput isEqualToString:#"Yes"]){
UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:#"Congrats" message:#"You are authorized "
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alertsuccess show];
[alertsuccess release];
} else {
UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Username or Password Incorrect"
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alertsuccess show];
[alertsuccess release];
}
And my server side code is
<?php
$con = mysql_connect("emriphone.db.6420177.hostedresource.com","emriphone","Light12-");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("emriphone", $con);
$u=$_GET['UserName'];
$pw=$_GET['UserPassword'];
$query = sprintf("SELECT UserName,UserPassword from appUsers WHERE UserName='%s' AND UserPassword='%s'", mysql_real_escape_string($u),mysql_real_escape_string($pw));
$login=mysql_query($query,$con) or die(mysql_error());
if(mysql_num_rows($login)==1){
$row =mysql_fetch_assoc($login);
echo 'YES'; exit;
}
else{
echo'NO';exit;
}
mysql_connect($con);
?>
Try Using Following Code
NSString *data = [[NSString stringWithFormat:#"UserName=%#&UserPassword=%#",userNameTextField.text, userPasswordTextFiled.text];
NSData *postData = [data dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:#"%d", [postData length]];
// preaparing URL request to send data.
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
NSString *url = [NSString stringWithFormat:#"http://www.myurl.com/emrapp/connect.php?"];
[request setURL:[NSURL URLWithString:url]];
[request setHTTPMethod:#"POST"];
[request setValue:postLength forHTTPHeaderField:#"Content-Length"];
[request setHTTPBody:postData];
[request setTimeoutInterval:7.0];
NSURLResponse *response;// = [[NSURLResponse alloc] init];
NSError *error;// = [[NSError alloc] init;
NSData *urlData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *str=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
NSLog(#"Login response:is %#",str);

passing parameter to the web service working code

again i am trying with soap method, but this time i downloaded the charles and observe the request that i create from my code. Chales showing "failed to parse data(org.xml.sax.saxparser exception:content is not allowed in prolog)"
here is my code:
NSString *soapMsg = [[NSString alloc] initWithFormat:#"\n"
"\n"
""
"\n"
"%#\n"
"%#\n"
"%#\n"
"%#\n"
"\n"
"\n"
"\n",str1,str2,str3,str4];
NSLog(soapMsg);
NSURL *url = [NSURL URLWithString:#"http://192.168.0.218:84/WebServiceCustomerByAmit/Service.asmx?op=InsertCustomerInformation"];
NSLog(#"url. . . .%#", url);
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
NSLog(#"req....%#", req);
NSString *msgLength = [NSString stringWithFormat:#"%d", [soapMsg length]];
NSLog(#"msgLength. . .%#", msgLength);
[req addValue: #"text/xml; charset=utf-8" forHTTPHeaderField:#"Content-Type"];
[req addValue: #"http://tempuri.org/InsertCustomerInformation" forHTTPHeaderField:#"SOAPAction"];
[req addValue: msgLength forHTTPHeaderField:#"Content-Length"];
[req setHTTPMethod:#"POST"];
[req setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(#"req....%#", req);
NSError *error;
NSURLResponse *response;
//NSData *urlData=[NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:req delegate:self];
if( theConnection )
{
//webData = [[NSMutableData data] retain];
NSLog(#"theConnection is OK");
}
else
{
NSLog(#"theConnection is NULL");
}
if(!response){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Connection Error" message:#"Failed to Connect to the Internet" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else{
UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:#"Connection Successful" message:#"Connected to the Internet" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert1 show];
[alert1 release];
}
}
help!! thanks in advance!!
You are asking how to include ASIHTTPRequest in your project, right? Copy and paste ASIHTTPRequest's folder in your project's folder and add this in your code:
#import "ASIHTTPRequest.h"
Note that ASIHTTPRequest is an external library and not part of the iOS SDK.

How to twit a picture with some text in iPhone

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];
}