2

Parse モバイル プラットフォームを使用して、Facebook のタイムラインにフィードを投稿しています。これは彼らがドキュメントで言ったことです:Note that if you already have the Facebook SDK installed in your app, our version of the Facebook SDK will happily work alongside it.

ここを見てください。 The Parse SDK includes the entire Facebook SDK. All the classes are namespaced with PF_ to avoid conflicts with existing libraries. So, for example, the main Facebook object class in our SDK is PF_Facebook.

これはFacebook SDKを使用して完全に動作します:

- (IBAction)postFacebook:(UIButton *)sender {    
    self.postParams =
    [[NSMutableDictionary alloc] initWithObjectsAndKeys:
     @"https://developers.facebook.com/ios", @"link",
     @"https://developers.facebook.com/attachment/iossdk_logo.png", @"picture",
     @"Facebook SDK for iOS", @"name",
     @"Here we go", @"message",
     @"Build great social apps and get more installs.", @"caption",
     @"The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.", @"description",
     nil];

    [FBRequestConnection startWithGraphPath:@"me/feed" parameters:self.postParams HTTPMethod:@"POST"
     completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        [self showAlert:@"Link is posted" result:result error:error];
     }];
}

しかし、PF_FBRequestConnection を使用すると機能しません。

[PF_FBRequestConnection startWithGraphPath:@"me/feed" parameters:params HTTPMethod:@"POST"
        completionHandler:^(PF_FBRequestConnection *connection, id result, NSError *error) {
            [self showAlert:@"Link is posted" result:result error:error];
    }];

コンソールのエラー:

Error: HTTP status code: 403

問題は、Parse を使用して投稿することはできphoto or Statusますが、ご覧のようにリンクを投稿することはできません。

助けてくれてありがとう。

4

2 に答える 2

2

問題は、使用していたフレームワークのバージョンでしたParseここでも確認できます。

たとえば、これはそのバージョン (1.1.12) ではサポートされていません。

[PF_FBSession.activeSession handleDidBecomeActive];

新しいバージョン (1.1.13) では問題が解決されています。だから私はこの方法を持つことができます:

// Convenience method to perform some action that requires the "publish_actions" permissions.
- (void) performPublishAction:(void (^)(void)) action {
    // we defer request for permission to post to the moment of post, then we check for the permission
    if ([PF_FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound) {
        // if we don't already have the permission, then we request it now
        [PF_FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"]
            defaultAudience:FBSessionDefaultAudienceFriends completionHandler:^(PF_FBSession *session, NSError *error) {
                if (!error) {
                    action();
                }
            //For this example, ignore errors (such as if user cancels).
        }];
    } else {
        action();
    }
}

そして、次のように使用します。

[self performPublishAction:^{
        [PF_FBRequestConnection startWithGraphPath:@"me/feed" parameters:self.postParams HTTPMethod:@"POST"
            completionHandler:^(PF_FBRequestConnection *connection, id result, NSError *error) {
                [self showAlert:@"Link is posted" result:result error:error];
        }];
    }];
于 2012-10-28T20:06:09.067 に答える
0

アプリの権限を確認する必要があります。Facebook SDK ドキュメントから

不十分な範囲:リクエストには、アクセス トークンによって提供されるよりも高い権限が必要です。リソース サーバーは、HTTP 403 (Forbidden) ステータス コードで応答する必要があり (SHOULD)、保護されたリソースにアクセスするために必要なスコープを含む "scope" 属性を含めることができます (MAY)。

于 2012-10-26T10:30:04.587 に答える