Ios 将视频上载到facebook时遇到异常
我正在尝试使用Social Framework将iPhone上的视频上传到用户的facebook时间线。我使用了中给出的代码片段。这是我的密码:Ios 将视频上载到facebook时遇到异常,ios,objective-c,facebook,slrequest,Ios,Objective C,Facebook,Slrequest,我正在尝试使用Social Framework将iPhone上的视频上传到用户的facebook时间线。我使用了中给出的代码片段。这是我的密码: - (void)performActivity { NSLog(@"sharing on facebook."); ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *facebookAccountType = [accountStore acco
- (void)performActivity {
NSLog(@"sharing on facebook.");
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSDictionary *options = @{ACFacebookAppIdKey : @"***", ACFacebookPermissionsKey : @[@"email"], ACFacebookAudienceKey:ACFacebookAudienceFriends};
[accountStore requestAccessToAccountsWithType:facebookAccountType options:options completion:^(BOOL granted, NSError *error) {
if (granted) {
NSDictionary *options = @{ACFacebookAppIdKey : @"***", ACFacebookPermissionsKey : @[@"publish_stream"], ACFacebookAudienceKey:ACFacebookAudienceFriends};
[accountStore requestAccessToAccountsWithType:facebookAccountType options:options completion:^(BOOL granted, NSError *error) {
if (granted) {
NSLog(@"Publishing");
ACAccount *fbAccount = [accountStore accountsWithAccountType:facebookAccountType][0];
NSURL *videourl = [NSURL URLWithString:@"https://graph.facebook.com/me/videos"];
NSURL *pathURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@session.mov", NSTemporaryDirectory()]];
NSData *videoData = [NSData dataWithContentsOfFile:[NSString stringWithFormat:@"%@session.mov", NSTemporaryDirectory()]];
NSDictionary *params = @{
@"title": @"Nebuu",
@"description": @"mebuu"
};
SLRequest *uploadRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodPOST
URL:videourl
parameters:params];
[uploadRequest addMultipartData:videoData
withName:@"source"
type:@"video/quicktime"
filename:@"Nebuu Video"];
uploadRequest.account = fbAccount;
[uploadRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
if(error){
NSLog(@"Error %@", error.localizedDescription);
}else
NSLog(@"%@", responseString);
}];
}}];
}}];
}
如你所见,我首先请求了阅读权限电子邮件,然后,如果第一个请求被批准,我请求了发布权限。代码工作正常,所有权限都被授予,应用程序开始上传视频。我可以在我的网络监控工具中看到这一点。但是,在上传视频后,我出现以下错误:
{
"error": {
"message": "An unexpected error has occurred. Please retry your request later.",
"type": "OAuthException"
}
}
这里可能有什么问题?我读了其他一些SO帖子,似乎有可能是Facebook方面的错误。有什么建议吗