Could you tell me how to use graph api to get the source url for a photo? Because I have the photo id and it seems like I should be able to make a call to get the source url.
As an example of what I’m trying to do, the following code works:
-(IBAction)showPicture:(UIButton *)sender;
{
//code to retrieve picture
id path = @"http://photos-e.ak.fbcdn.net/photos-ak-snc1/v5041/89/51/40796308305/a40796308305_1960517_6704612.jpg";
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
[self.label setText: (NSString *)path];
imageView.image = img;
[img release];
}
However that works when I have the source url. Is there a way to use graph api so that I can substitute id path = @"http://..." for something like id path = [_facebook requestWithGraphPath:@"98423808305/source" andDelegate:self]; ???
Updated to include request didLoad method
- (void)request:(FBRequest *)request didLoad:(id)result {
if ([request.params objectForKey:@"picture"]) {
// Get photo ID from result
NSString *photoId = (NSString *)[result objectForKey:@"id"];
shitStorm = photoId;
}
if ([result isKindOfClass:[NSArray class]]) {
result = [result objectAtIndex:0];
}
if ([result objectForKey:@"owner"]) {
[self.label setText:@"Photo upload Success"];
} else {
[self.label setText:[result objectForKey:@"name"]];
}
};
then in the request response you’ll get every information about the picture. See an example here:
https://graph.facebook.com/98423808305
Grab your required info, might against the key “source”, and use it as you want. http://developers.facebook.com/docs/reference/api/ this is a very good place to learn while developing with FB.
Might this will give you idea how to sort different requests.
Similarly you can sort different requests and hence perform different request specific tasks.