what to change in this code If I want to post videos in Facebook in iPhone?

空扰寡人 提交于 2019-12-25 18:13:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!