1

引用を共有するiOSアプリケーションの1つにfacebook統合を使用しています。しかし問題は、引用が私のタイムラインに投稿されたときに、友達が「いいね」と「コメント」だけを共有できないことです。スクリーンショットを添付して共有したいので、FBアプリに問題があるか、iOSでそのコードを実行する必要があります。

FBのスクリーンショット

前もって感謝します

4

1 に答える 1

0

スクリーンショットを確認しました。それは基本的にfbの「いいね」のように見えます。誰もこの投稿を共有できないため。最新の ios fb sdk 3.1.1 を使用し、その FB sdk を iOS アプリと統合することをお勧めします。次に、次のコードを使用します

iOS 6 以降では、iOS 6 ネイティブの fb ポスト メソッドを使用します。

if(NSClassFromString(@"SLComposeViewController") != nil) {

        UIApplication* app = [UIApplication sharedApplication];
        app.networkActivityIndicatorVisible = NO;

        SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

        SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
            if (result == SLComposeViewControllerResultCancelled) {

                NSLog(@"\nCancelled");                
            } else
            {
                NSLog(@"\nDone");
            }

            [controller dismissViewControllerAnimated:YES completion:Nil];
        };
        controller.completionHandler =myBlock;

        [controller setInitialText:FB_POST_FEED_INITIAL_TEXT_MSG];
        [controller addURL:[NSURL URLWithString:BITLY_VIEW_LINK]]; // youtube video link

        [self presentViewController:controller animated:YES completion:Nil];
}

それ以外の場合は、次の FB SDK メソッドを使用します。

    [FBSession openActiveSessionWithReadPermissions:nil
                                       allowLoginUI:YES
                                  completionHandler:
     ^(FBSession *session,
       FBSessionState state, NSError *error) {
         switch (state) {
             case FBSessionStateOpen:
                 //first shows the hud view then initiating the post message feed process
                 [self postFBMessageOnUserWall];
                  break;
             case FBSessionStateClosed:
                 //need to handle
                 break;
             case FBSessionStateClosedLoginFailed:
                 //need to handle
                 break;
             default:
                 break;
         }
     }];


-(void)postFBMessageOnUserWall {
    NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                             FB_POST_FEED_INITIAL_TEXT_MSG, @"name", BITLY_VIEW_LINK, @"link", nil];

     [FBRequestConnection
      startWithGraphPath:@"me/feed"
      parameters:params
      HTTPMethod:@"POST"
      completionHandler:^(FBRequestConnection *connection,
                          id result,
                          NSError *error) {

          //show the alert says that message successfully posted in your wall
          [self performSelectorOnMainThread:@selector(showAlertFromMainThread:) withObject:error waitUntilDone:NO];

          NSLog(@"\n\nfb post feed error status  = %@", error);
      }];
}
于 2013-02-08T19:19:54.440 に答える