5

私はstackoverflowとインターネットを検索してきましたが、私の意図に合った解決策が見つかりませんでした。

文字列をパラメータとしてメソッドを呼び出し、ダイアログを表示せずにFacebookのウォールに投稿したいと思います。もちろん、有効なセッションが利用可能な場合のみ。

私はこれを試しました:

// post message to facebook pinnwall
- (void)postOnWall:(NSString *)message {

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: message, @"message",nil];
    [[FBRequest request] call:@"facebook.stream.publish" params:params];
}

作業方法を教えてもらえますか?

ありがとう、乾杯、ドゥーノット

4

4 に答える 4

9

Abyが言ったように、FBを最大限に活用するためのGraphAPIを検討する必要があります。

簡単なコード:

NSMutableDictionary *fbArguments = [[NSMutableDictionary alloc] init];

NSString *wallPost = @"the super wall post";
NSString *linkURL  = @"http://www.supersite.com";
NSString *imgURL   = @"http://www.supersite.com/image.jpg";

[fbArguments setObject:wallPost forKey:@"message"];
[fbArguments setObject:linkURL  forKey:@"link"];
[fbArguments setObject:imgURL   forKey:@"picture"];

[facebook requestWithGraphPath:@"me/feed" 
                    andParams:fbArguments
                andHttpMethod:@"POST"
                  andDelegate:self];
于 2011-05-24T08:12:40.453 に答える
0

Graph APIを使用してみましたか。
ダイアログボックスのようにユーザーの操作なしでアプリケーションを壁に印刷したい場合は、GraphAPIを使用できます 。http://developers.facebook.com/docs/reference/api/post //

于 2011-03-24T20:13:06.473 に答える
0

Facebookに投稿WalluはJSONを通過する必要があります

このdelgatesをチェックしてください

- (void)postToWall {

    FBStreamDialog *dialog =[[[FBStreamDialog alloc]init ]autorelease];

    dialog.userMessagePrompt = @"Whats on your Mind about this Articles...";
    dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"The Black Sheep: %@ Specials for %@, %@ \",\"href\":\"http://%@/\",\"caption\":\" %@ \",\"description\":\"\",\"media\":[{\"type\":\"image\",\"src\":\"%@\",\"href\":\"http://www.raywenderlich.com/\"}]}",
                         [[BarSplArr objectAtIndex:0]objectForKey:@"barname"],day,date,[[BarSplArr objectAtIndex:0]objectForKey:@"barwebsite"],[[BarSplArr objectAtIndex:0]objectForKey:@"drinkspecials"],[[BarSplArr objectAtIndex:0]objectForKey:@"barimage"]];
    //dialog.actionLinks = @"[{\"text\":\"See My App here!\",\"href\":\"http://www.facebook.com/developers/apps.php?app_id=178257532217623&ret=2/\"}]";
    [dialog show];
}

より良いuはこの方法でフォローアップすることができます。 http://www.raywenderlich.com/77/how-to-post-on-facebook-with-your-iphone-app

素晴らしいチュートリアル

于 2011-03-03T18:03:53.147 に答える
0

注:「publish_actions」権限が必要であり、accessTokenとユーザーがログインしているかどうかを処理および確認する必要があります。

func postMessageOnFaceBookWall() 
   {
        FBSDKGraphRequest(graphPath: "me/feed", parameters: ["message": "Hello my test post"], httpMethod: "POST").start { (connection, result, error) in
            if error == nil{
                //Handle your response here
           }
            else{
               // error
            }
        }
    }
于 2017-08-04T10:10:34.813 に答える