将视频上载到facebook错误2
我正在尝试将iphone应用程序拍摄的视频上传到Facebook 在我的应用程序的.plist中,我添加了 FacebookAppId、FacebookDisplayName、URLSchemes,我已经向Facebook开发者注册了我的应用程序 在iPhone设置中,我的应用程序可以使用Facebook帐户 然后我允许我的用户对视频进行标题和描述,然后点击一个按钮将其上传到Facebook将视频上载到facebook错误2,facebook,video,upload,Facebook,Video,Upload,我正在尝试将iphone应用程序拍摄的视频上传到Facebook 在我的应用程序的.plist中,我添加了 FacebookAppId、FacebookDisplayName、URLSchemes,我已经向Facebook开发者注册了我的应用程序 在iPhone设置中,我的应用程序可以使用Facebook帐户 然后我允许我的用户对视频进行标题和描述,然后点击一个按钮将其上传到Facebook - (void)buttonRequestClickHandler:(id)sender {
- (void)buttonRequestClickHandler:(id)sender {
if (FBSession.activeSession.isOpen) {
//this is the path to the video
NSString *audioName = [pictureDictionary4 objectForKey:@"photoVideokey"];
NSArray *pathsa = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectorya = [pathsa objectAtIndex:0];
NSString *moviePath = [documentsDirectorya stringByAppendingPathComponent:@"/Movie"];
NSString *fullPatha = [moviePath stringByAppendingPathComponent:audioName];
NSURL *pathURL = [[NSURL alloc]initFileURLWithPath:fullPatha isDirectory:NO];
NSData *videoData = [NSData dataWithContentsOfFile:fullPatha];
//these are the title and description of the video
NSString *titleString = self.videotitle.text;
NSString *descripString = self.descrp.text;
NSDictionary *videoObject = @{
@"title":titleString,
@"description": descripString,
[pathURL absoluteString]: videoData
};
FBRequest *uploadRequest = [FBRequest requestWithGraphPath:@"me/videos"
parameters:videoObject
HTTPMethod:@"POST"];
[uploadRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error)
NSLog(@"Done: %@", result);
else
NSLog(@"Error: %@", error.localizedDescription);}];
}
这就是操作无法完成时出现的错误。(com.facebook.sdk错误2。)
因此,显然我没有从appDelegate获得会话,也没有在此处登录。
else {
permissions = [NSMutableArray arrayWithObjects:@"publish_actions",@"publish_streams",nil];
[FBSession openActiveSessionWithPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceOnlyMe
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// if login fails for any reason, we alert THIS IS THE ERROR I GET
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
// if otherwise we check to see if the session is open, an alternative to
// to the FB_ISSESSIONOPENWITHSTATE helper-macro would be to check the isOpen
// property of the session object; the macros are useful, however, for more
// detailed state checking for FBSession objects
} else if (FB_ISSESSIONOPENWITHSTATE(status)) {
// send our requests if we successfully logged in
NSString *audioName = [pictureDictionary4 objectForKey:@"photoVideokey"];
NSArray *pathsa = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectorya = [pathsa objectAtIndex:0];
NSString *moviePath = [documentsDirectorya stringByAppendingPathComponent:@"/Movie"];
NSString *fullPatha = [moviePath stringByAppendingPathComponent:audioName];
NSString *titleString = self.videotitle.text;
NSString *descripString = self.descrp.text;
NSURL *pathURL = [[NSURL alloc]initFileURLWithPath:fullPatha isDirectory:NO];
NSData *videoData = [NSData dataWithContentsOfFile:fullPatha];
NSDictionary *videoObject = @{
@"title":titleString,
@"description": descripString,
[pathURL absoluteString]: videoData};
FBRequest *uploadRequest = [FBRequest requestWithGraphPath:@"me/videos"
parameters:videoObject
HTTPMethod:@"POST"];
[uploadRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error)
NSLog(@"Done: %@", result);
else
NSLog(@"Error: %@", error.localizedDescription);}];
}}];
}}
有人能看到我在登录会话时哪里出了问题吗
如果有人能帮我,我将不胜感激。所以我稍微改变了一下。我正在使用HelloFacebookSample应用程序中的代码来确保我已登录并且不再出现错误2。调试器显示视频开始上传,因为它显示视频数据的NSLog。然而,过了一段时间,数据流开始显示00000000 00000000 00000000 00000000,然后可能会显示一些类似于6d766578 00000020的数据流,然后随着频率的增加再次返回到零。然后,最后它错误了 2013-06-27 22:50:14.407我的小世界应用程序[8145:907]错误:操作无法完成。(com.facebook.sdk错误5)
不确定这意味着什么,但将发布另一个问题。这与Xcode无关。在某种程度上,这与Xcode有关,因为我试图将facebook视频上传集成到使用Xcode@userXXX如果你使用Eclipse,你会考虑这个问题吗?或者
emacs
和make
?我怀疑。