我想从我的
IOS应用程序到Facebook进行实时视频流.我有两个facebook帐户:第一个 – 注册的iOS应用程序,第二个帐户 – 仅用于测试.如果我使用我的第一个帐户(在我的iOS应用程序中)登录 – 我获得了所需的rtmp://rtmp-api.facebook.com:80 / rtmp URL和流媒体的密钥(FB文档中所述的所有内容:
https://developers.facebook.com/docs/videos/live-video-api).但如果我使用第二个帐户登录,我收到此错误:
com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 100;
"fbtrace_id" = Ed9BmMChIsn;
message = "(#100) No permission to perform current operation.";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400,
我的直播流代码:
- (void)enableFacebookLiveStreamingWithCompletionHandler:(void(^)(NSString* facebookStreamURL, NSString* facebookStreamKey, NSError* error))completionHandler;
{
dispatch_async(dispatch_get_main_queue(), ^{
if ([[FBSDKAccessToken currentAccessToken] hasGranted:permissionPublishActions])
{
NSString* liveVideosRequestPath = [NSString stringWithFormat:@"/%@/live_videos",[FBSDKAccessToken currentAccessToken].userID];
FBSDKGraphRequest* request = [[FBSDKGraphRequest alloc] initWithGraphPath:liveVideosRequestPath parameters:nil HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
NSLog(@"%@",[FBSDKAccessToken currentAccessToken].permissions);
if (error)
{
if (completionHandler)
completionHandler(@"",@"",error);
}
else
{
if (completionHandler)
completionHandler(@"rtmp://rtmp-api.facebook.com:80/rtmp/",[[result objectForKey:@"stream_url"] lastPathComponent],nil);
}
}];
}
});
}
P.S //非常有趣,即使我已经在这里包含了所有权限:https://developers.facebook.com/tools/explorer,对我来说同样拒绝访问第二个帐户进行测试(应用程序未注册)!
请帮帮我.
最佳答案 大多数权限需要由Facebook审核,否则您只能将其用作在App中具有角色的用户.阅读文档:
https://developers.facebook.com/docs/facebook-login/review中的“登录审核”