gpt4 book ai didi

ios - 操作无法完成。 (com.facebook.sdk 错误 5.) FACEBOOK 视频上传

转载 作者:可可西里 更新时间:2023-11-01 03:34:31 25 4
gpt4 key购买 nike

我编写了以下代码,用于将视频从 iOS 设备上传到 facebook。

-(void)uploadVideo {

NSLog(@"UPload Videio ");


NSString *filePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"mov"];

NSLog(@"Path is %@", filePath);

NSData *videoData = [NSData dataWithContentsOfFile:filePath];

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, @"video.mov",
@"video/quicktime", @"contentType",
@"Video Test Title", @"title",
@"Video Test Description", @"description",
nil];
// [facebook requestWithGraphPath:@"me/videos"
// andParams:params
// andHttpMethod:@"POST"
// andDelegate:self];

if (FBSession.activeSession.isOpen) {


[FBRequestConnection startWithGraphPath:@"me/videos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

if(!error) {
NSLog(@"OK: %@", result);
} else
NSLog(@"Error: %@", error.localizedDescription);

}];

} else {

// We don't have an active session in this app, so lets open a new
// facebook session with the appropriate permissions!

// Firstly, construct a permission array.
// you can find more "permissions strings" at http://developers.facebook.com/docs/authentication/permissions/
// In this example, we will just request a publish_stream which is required to publish status or photos.

NSArray *permissions = [[NSArray alloc] initWithObjects:
@"publish_stream",
nil];



//[self controlStatusUsable:NO];
// OPEN Session!
[FBSession openActiveSessionWithPermissions:permissions
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// if login fails for any reason, we alert
if (error) {

// show error to user.

} else if (FB_ISSESSIONOPENWITHSTATE(status)) {

// no error, so we proceed with requesting user details of current facebook session.


[FBRequestConnection startWithGraphPath:@"me/videos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
// [FBRequestConnection setVideoMode:NO];

if(!error) {
NSLog(@"VEEERRRRRRR: %@", result);
} else
NSLog(@"VVEEERRRRREEEERRR: %@", error.localizedDescription);

}];





//[self promptUserWithAccountNameForUploadPhoto];
}
// [self controlStatusUsable:YES];
}];
}
}

这给了我错误操作无法完成。 (com.facebook.sdk 错误 5.)

我不知道 facebook 有什么问题。它上传图像、文本,但在视频中出现此错误。

注意:

  1. 这不是因为要一次又一次地发送,因为我也通过创建新帐户和重置 iOS 设备进行了测试。
  2. sample.mov 也存在并可与图形 API 一起使用,但问题在于此 SDK。

谢谢。

最佳答案

出现 com.facebook.sdk 错误 5 的几个原因:

  • session 未打开。验证。
  • Facebook 检测到您在向系统发送垃圾邮件。更改视频名称。
  • Facebook 对使用 SDK 有明确的限制。尝试不同的应用程序。
  • 错误的发布权限。尝试一下 publish_actions。
  • 这里有更多... ?

关于ios - 操作无法完成。 (com.facebook.sdk 错误 5.) FACEBOOK 视频上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19617544/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com