gpt4 book ai didi

ios - 我想使用我的 iOS 应用程序在 Facebook 墙上发布带有自定义文本的视频

转载 作者:行者123 更新时间:2023-11-29 01:48:00 24 4
gpt4 key购买 nike

我已关注 Facebook 文档以获取带消息的视频帖子。

示例代码如下:

NSURL *urlString = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"]];

NSData *videodata=[NSData dataWithContentsOfURL:urlString];

NSURL *imgUrl=[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"images" ofType:@"jpg"]];

NSData *imagedata=[NSData dataWithContentsOfURL:imgUrl];
NSDictionary *params = @{
@"source": videodata,
@"thumb": imagedata,
@"description":@"#BHARAT",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"videos"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
NSLog(@" Result-%@",result);
NSLog(@"Error=%@",error);
}];

但它给我的错误如下

Error=Error Domain=com.facebook.sdk.core Code=8 "The operation couldn’t be completed. (com.facebook.sdk.core error 8.)" UserInfo=0x16547ac0 {com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown error has occurred., NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter: 0x16555040>, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=1, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=1, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={ body = { error = { code = 1; message = "An unknown error has occurred."; type = OAuthException; }; }; code = 500; }, NSLocalizedRecoveryOptions=( OK ), NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again.}

请提供示例代码。

最佳答案

尝试使用下面的代码

 - (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSURL *urlString = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"]];

FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = videoURL;
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video;
...

// Assuming self implements <FBSDKSharingDelegate>
[FBSDKShareAPI shareWithContent:content delegate:self];
}

注意:视频应小于 12 MB

关于ios - 我想使用我的 iOS 应用程序在 Facebook 墙上发布带有自定义文本的视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31694303/

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