Skip to content

Commit

Permalink
Use the Graph API for the photo uploading example.
Browse files Browse the repository at this point in the history
Summary:
Edited uploadPhoto to use requestWithGraphPath instead of the legacy REST api
requestWithMethodName method. Also added the publish_stream permission, which
is
needed for uploading photos.

Test Plan:
Run the DemoApp and login. Click the upload button and verify that a photo was
uploaded to the user's Facebook account (pending approval).

Reviewed By: yariv
Reviewers: yariv
CC: yariv
Differential Revision: 257551
  • Loading branch information
seshness committed May 27, 2011
1 parent 8313546 commit fc1cde2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions sample/DemoApp/Classes/DemoAppViewController.m
Expand Up @@ -44,7 +44,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
_permissions = [[NSArray arrayWithObjects:
@"read_stream", @"offline_access",nil] retain];
@"read_stream", @"publish_stream", @"offline_access",nil] retain];
}

return self;
Expand Down Expand Up @@ -159,7 +159,6 @@ - (IBAction)publishStream:(id)sender {
[_facebook dialog:@"feed"
andParams:params
andDelegate:self];

}

/**
Expand All @@ -174,10 +173,12 @@ - (IBAction)uploadPhoto:(id)sender {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
[_facebook requestWithMethodName:@"photos.upload"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];

[_facebook requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];

[img release];
}

Expand Down

0 comments on commit fc1cde2

Please sign in to comment.