问题
I want to upload video on Facebook .
for this I am using my this old code , but it is not allow me to post videos in Facebook .
- (id)initWithImage:(UIImage *)upload_image {
if (self = [super init]) {
self.uploadImage = upload_image;
}
return self;
}
/** * this way the class is easily extensible to other file * types as FB allows us to upload them into the graph... * with little if any modification to the code **/
- (void)appendDataToBody:(NSMutableData *)body {
/**
* Facebook Graph API only support images at the moment, surely videos must occur soon.
**/
NSData *picture_data = UIImagePNGRepresentation(uploadImage);
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"media\";\r\nfilename=\"media.png\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:picture_data];
}
Can anyone tell me what should I change here ? to post the video in Facebook?
回答1:
you can download the official video upload tutorial given to below link
Official demo of the video Upload
And change into the API key which is created onto
https://developers.facebook.com
Form there copy API key and put into following method
- (void)viewDidLoad
{
facebook = [[Facebook alloc] initWithAppId:@"Your Key"];
}
And Also change into plist file also

Thanks and Regards,
Neon Samuel
来源:https://stackoverflow.com/questions/11791105/what-to-change-in-this-code-if-i-want-to-post-videos-in-facebook-in-iphone