Skip to content

Instantly share code, notes, and snippets.

@gregheo

gregheo/gist:4122880

Created Nov 21, 2012
Embed
What would you like to do?
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
You can’t perform that action at this time.