Uploading UIImage to server using UIImageJPEGRepresentation
Posted
by Thomas Joos
on Stack Overflow
See other posts from Stack Overflow
or by Thomas Joos
Published on 2010-04-22T08:01:25Z
Indexed on
2010/04/22
8:03 UTC
Read the original article
Hit count: 373
hi all,
I'm writing an app which uploads a UIImage to my server. This works perfect, as I see the pictures being added. I use the UIImageJPEGRepresentation for the image data and configure an NSMutableRequest. ( setting url, http method, boundary, content types and parameters )
I want to display an UIAlertView when the file is being uploaded and I wrote this code:
//now lets make the connection to the web
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
NSLog(@"return info: %@", returnString);
if (returnString == @"OK") {
NSLog(@"you are snapped!");
// Show message image successfully saved
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"You are snapped!" message:@"BBC snapped your picture and will send it to your email adress!" delegate:self cancelButtonTitle:@"OK!" otherButtonTitles:nil];
[alert show];
[alert release];
}
[returnString release];
The returnString outputs: 2010-04-22 09:49:56.226 bbc_iwh_v1[558:207] return info: OK
The problem is that my if statements does not say returnstring == @"OK" as I don't get the AlertView.
How should I check this returnstring value?
© Stack Overflow or respective owner