views:

54

answers:

1

Hello, I wrote a little app that uploads a selected picture form the ImagePicker to twitpic with this code (extract):

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissModalViewControllerAnimated:YES];
    UIImage * images = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    NSData *imageData = UIImageJPEGRepresentation(images, 1);
    NSURL *url = [NSURL URLWithString:@"http://twitpic.com/api/upload"];
    NSString *username = @"Username";
    NSString *password = @"HAHA";

    [networkQueue cancelAllOperations];
    [networkQueue setShowAccurateProgress:YES];
    [networkQueue setUploadProgressDelegate:progressIndicator];
    [networkQueue setDelegate:self];
    // Now, set up the post data:
    ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];

    [request setData:imageData forKey:@"media"];
    [request setPostValue:username forKey:@"username"];
    [request setPostValue:password forKey:@"password"];

    // Initiate the WebService request
    progressIndicator.hidden = NO;
    [networkQueue addOperation:request];
    [networkQueue go];
}

As you can see, I used ASIFormDataRequest to send a Request and ASINetworkQueue for the status of the upload. How can I get the link to the twitpic-site with the uploaded image (not the direct link to the image)?

Thanks for your help!

A: 

Got it with this code:

[networkQueue setRequestDidFinishSelector:@selector(requestFinished:)];

And with the methode:

- (void)requestFinished:(ASIHTTPRequest *)request
{    //NSString *response = [request responseString];
    //NSLog(@"%@", response);
}
Flocked