在iOS上从网页请求BLOB

I have a BLOB image stored in a MySQL database, of which I would like to use in my iOS Application. I have created a PHP file to retrieve the BLOB from the database, but I am unsure of what I need to do to get the BLOB into my app.

Please can you give me an example, or point me in the direction of doing so?

Thanks in advanced!

Use ASIIHTTPRequest to request the BLOB data from that PHP page.

With the BLOB data, convert it to a UIImage.

- (void) getBlobData:(NSURL *) url {
    NSURL *url = [NSURL URLWithString:url];
    __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setCompletionBlock:^{
       NSData *blobData = [request responseData];
       UIImage *blobImage = [UIImage imageWithData:blobData] retain];
       [someImageView performSelectorOnMainThread:@selector(setImage:)
       withObject:blobImage 
       waitUntilDone:YES];
    }];

    [request setFailedBlock:^{
      NSError *error = [request error];
    }];
    [request startAsynchronous];
}

Alternatively, you could use Grand Central Dispatch (GCD) to send a request to the web-page in order to receive the blob:

- (void) getBlobData:(NSURL *) url {

    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul); 
    dispatch_async(queue, ^{  
        NSData *blobData = [NSData dataWithContentsOfURL:url];       
        UIImage *blobImage = [UIImage imageWithData:blobData];
        dispatch_sync(dispatch_get_main_queue(), ^{
             [someImageView setImage:blobImage];
         });
     }); 
}