Skip to content
Browse files

Use the Graph API for the photo uploading example.

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...
1 parent 8313546 commit fc1cde21ae7359255b59a24e4845a7da97ee3ec8 @seshness seshness committed May 25, 2011
Showing with 7 additions and 6 deletions.
  1. +7 −6 sample/DemoApp/Classes/DemoAppViewController.m
View
13 sample/DemoApp/Classes/DemoAppViewController.m
@@ -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;
@@ -159,7 +159,6 @@ - (IBAction)publishStream:(id)sender {
[_facebook dialog:@"feed"
andParams:params
andDelegate:self];
-
}
/**
@@ -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];
}

0 comments on commit fc1cde2

Please sign in to comment.
Something went wrong with that request. Please try again.