本文介绍了iphone ShareKit与视频上传的Facebook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何使用Sharekit将视频发布到Facebook?我应该定制它,还是有一些已经在那里的东西可以从sharekit这样做?任何扩展程序可以下载?



谢谢!

解决方案

使用该共享工具我建议使用FBGraphAPI这个...



以下是以下步骤,您可以在Facebook上发布视频..



in .h文件

  #importFbGraph.h
#import FbGraphFile.h
#importJSON.h
#import< MobileCoreServices / MobileCoreServices.h>

@interface ViewController:UIViewController
{
FbGraph * FB_Graph;
FbGraphResponse * FB_Graph_Response;
FbGraphFile * FB_Graph_File;
}

- (IBAction)btnShareVideoPress:(id)sender;

@end

在.m文件中调用此方法....

   - (void)viewDidAppear:(BOOL)animated 
{
[super viewDidAppear:animated] ;

NSString * ClientID = @197556430726736;

FB_Graph = [[FbGraph alloc] initWithFbClientID:ClientID];

[FB_Graph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback :) andExtendedPermissions:@user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins];


- (IBAction)btnShareVideoPress:(id)sender
{
NSString * path = [[NSBundle mainBundle] pathForResource:@YouTubeTestofType:@ M4V];
NSURL * videoURL1 = [NSURL fileURLWithPath:path];

NSMutableDictionary * variables = [[NSMutableDictionary alloc] init];

FB_Graph_File = [[[FbGraphFile alloc] initwithURL:videoURL1] retain];

[变量setObject:FB_Graph_File forKey:@file];

[变量setObject:@测试视频上传1forKey:@message];
[变量setObject:@videoforKey:@MediaType];
[FB_Graph doGraphPost:@我/视频withPostVars:variables];

FbGraphResponse * fb_graphresponse = [FB_Graph doGraphGet:@me / videos / uploadedwithGetVars:variables];

NSLog(@postPictureButtonPressed:%@,fb_graphresponse.htmlResponse);
}


Does anyone know how i can use Sharekit to post a video to facebook? Should i customize it or is there something already out there that can do this from sharekit? Any extensions i can download?

Thanks!

解决方案

Instead of using the sharekit i suggest to use FBGraphAPI for this...

Here are the following steps, that you can post video on Facebook..

in .h file

#import "FbGraph.h"
#import "FbGraphFile.h"
#import "JSON.h"
#import <MobileCoreServices/MobileCoreServices.h>

@interface ViewController : UIViewController
{
    FbGraph                 *FB_Graph;
    FbGraphResponse         *FB_Graph_Response;
    FbGraphFile             *FB_Graph_File;
}

-(IBAction)btnShareVideoPress:(id)sender;

@end

in .m file call this method.....

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    NSString *ClientID = @"197556430726736";

    FB_Graph = [[FbGraph alloc]initWithFbClientID:ClientID];

    [FB_Graph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];
}

-(IBAction)btnShareVideoPress:(id)sender
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"YouTubeTest" ofType:@"m4v"]; 
    NSURL *videoURL1=[NSURL fileURLWithPath:path];

    NSMutableDictionary *variables = [[NSMutableDictionary alloc]init];

    FB_Graph_File = [[[FbGraphFile alloc] initwithURL:videoURL1]retain];

    [variables setObject:FB_Graph_File forKey:@"file"];

    [variables setObject:@"Test video upload 1" forKey:@"message"];
    [variables setObject:@"video" forKey:@"MediaType"];
    [FB_Graph doGraphPost:@"me/videos" withPostVars:variables];

    FbGraphResponse *fb_graphresponse = [FB_Graph doGraphGet:@"me/videos/uploaded" withGetVars:variables];  

    NSLog(@"postPictureButtonPressed:  %@", fb_graphresponse.htmlResponse);
}

这篇关于iphone ShareKit与视频上传的Facebook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 04:05