Skip to content

Instantly share code, notes, and snippets.

@gregheo
Created November 21, 2012 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregheo/4122880 to your computer and use it in GitHub Desktop.
Save gregheo/4122880 to your computer and use it in GitHub Desktop.
FB upload example
-(void) uploadVideo {
NSMutableDictionary *fbParams = @{@"title": @"Video Title",
@"description": @"Video Description",
@"json", @"format"};
FBVideoUpload *faceBookVideoUpload = [[FBVideoUpload alloc] init];
faceBookVideoUpload.apiKey = APP_KEY;
faceBookVideoUpload.appSecret = APP_SECRET;
faceBookVideoUpload.accessToken = accessToken;
[faceBookVideoUpload startUploadWithURL:videoURL fbParams delegate:self];
}
// ------------------------------------------------------------------------------------
- (void) startUploadWithURL: (NSURL*) movieURL
params: (NSDictionary*) userParams
delegate: (id <FBRequestDelegate>) delegate
{
NSString* requestURL = [NSString stringWithFormat:@"https://graph-video.facebook.com/me/videos?&access_token=%@", accessToken];
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:accessToken, @"access_token",
[userParams objectForKey:@"title"], @"title",
[userParams objectForKey:@"description"], @"description",
@"my_video.mov", @"file",
[NSData dataWithContentsOfURL:movieURL], @"my_video.mov", nil];
[[FBRequest getRequestWithParams:[params mutableCopy] httpMethod:@"POST" delegate:delegate requestURL:requestURL] connect];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment