2012-04-16 15 views
0

ユーザからの少しのメッセージblurb( 'message'パラメータ)を除いて、すべてのパラメータが正しくポストされます。どのようにポストのこの部分は、Facebookに表示されません来る?パラメータを間違って設定していますか? 私が話しているその記事の一部を確認するには、この画像をチェックしてみて下さい: https://skitch.com/hahmadi82/8uecw/brenton-joyninFacebook IOS SDK requestWithGraphはメッセージを投稿しません

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
                 [NSString stringWithFormat:@"%@ has invited you (%@) to enjoy an offer at %@ on %@", [nameArray objectAtIndex:0], [facebookNameArray objectAtIndex:i], spotString, timeChosenString], @"name", 
                 domain, @"link", 
                 [NSString stringWithFormat:@"%@ (%@)", offerString, peopleString], @"caption", 
                 @"Going out? Use JoynIn to grab amazing offers from local bars, clubs, and restaurants. All you need to bring is friends!", @"description", 
                 titleChosen.text, @"message",    
                 nil]; 
         [facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/feed/",[facebookUIDArray objectAtIndex:i]] andParams:params andHttpMethod:@"POST" andDelegate:self]; 

答えて

0

まず、子供が言うことで、「どのように来ます」。 LOL申し訳ありません。次に、これは別のユーザーのフィードに投稿しています。だからあなたは自分の壁ではなく、その柱のために自分の壁をチェックしなければなりません。

私はあなたが説明を入れなければならないと信じています。ここでは、私たちが使用するコードを示します。あなたのコードがうまくいくようです。また、%@フォーマッタに正しいFacebook IDがあることを確認する必要があります。

NSString *message = NSLocalizedString(@"FACEBOOK_INVITE_MESSAGE", nil); 
NSString *link = @"http://www.facebook.com/trivialapp"; 
NSString *description = NSLocalizedString(@"FACEBOOK_INVITE_DESCRIPTION", nil); 
NSString *picture = @"http://trivi.al/Content/images/icon72.png"; 
NSMutableDictionary *tParams = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           message,  @"message", 
           link,  @"link", 
           description, @"description", 
           picture,  @"picture", nil]; 

[facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/feed", [playerDict objectForKey:@"id"]] 
         andParams:tParams 
        andHttpMethod:@"POST" 
        andDelegate:self]; 
0

あなたのFacebookセッションは有効ですか? if文で確認する:

 if (facebook isSessionValid) { 
NSLog (@"Working fine..."); // it might also be better to place the post method in here and put an else statement to open a alert where it says error or something like that 
} 

ない場合....私は非常によく似ていたではない場合....そこ

handleOpenURLとfbDidLogin

ログのようなあなたの方法を確認し、呼ばれるかどうかを確認問題...病気は...だから私の問題は、私はアプリの委任にFacebookの変数を宣言しているはずだった

をご案内し、これはあなたが何をすべき見..ですこれを見て:

 - (void)viewDidLoad 
    { 
fbAppDelegate = (NerdfeedAppDelegate *)[[UIApplication sharedApplication] delegate]; 
[[fbAppDelegate facebook] authorize:nil];// or wherever you wanna put it... 
[super viewDidLoad]; 
// Do any additional setup after loading the view from its nib. 
    } 

    -(IBAction)post { 

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
                [NSString stringWithFormat:@"%@ has invited you (%@) to enjoy an offer at %@ on %@", [nameArray objectAtIndex:0], [facebookNameArray objectAtIndex:i], spotString, timeChosenString], @"name", 
                domain, @"link", 
                [NSString stringWithFormat:@"%@ (%@)", offerString, peopleString], @"caption", 
                @"Going out? Use JoynIn to grab amazing offers from local bars, clubs, and restaurants. All you need to bring is friends!", @"description", 
                titleChosen.text, @"message",    
                nil]; 
        [fbAppDelegate.facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/feed/",[facebookUIDArray objectAtIndex:i]] andParams:params andHttpMethod:@"POST" andDelegate:self]; 



    } 

のApp Delegate.h:

@interface AppDelegate : UIResponder <UIApplicationDelegate, FBSessionDelegate, FBDialogDelegate, FBLoginDialogDelegate, FBRequestDelegate> 

    { 

    Facebook *facebook; 

    } 


    @property (strong, nonatomic) UIWindow *window; 
    @property (strong, nonatomic) Facebook *facebook; 

のApp Delegate.m:

 static NSString *kAppID; 
     - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { 
return [facebook handleOpenURL:url]; 
    } 

    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 
return [facebook handleOpenURL:url]; 
} 
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    kAppID = [[NSString alloc] initWithString:@"//app id"]; 
    // .... 
    facebook = [[Facebook alloc] initWithAppId:kAppId andDelegate:(id)self.viewController]; 
     [facebook setSessionDelegate:self]; 
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
     if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) { 
     facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; 
     facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; 
    } 

return YES; 
    } 


- (void)fbDidLogin { 

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"]; 
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"]; 
[defaults synchronize];  
     } 

    -(void)fbDidLogout { 


// Remove saved authorization information if it exists 
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 

if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) { 
    [defaults removeObjectForKey:@"FBAccessTokenKey"]; 
    [defaults removeObjectForKey:@"FBExpirationDateKey"]; 
    [defaults synchronize]; 
    } 
    } 
+0

私のポストのすべてのパラメータは、メッセージを除いて正常に動作します。問題は投稿していないということではなく、ユーザーからの小さなメッセージのコメントをすべて送信しています。私の推測では、私はパラメータを正しく設定していないということですか? –

0

あなたはポスト]ダイアログボックスでメッセージを公開することを意味している場合、実際に可能ではないthatsの、私は同じ問題に直面し、私はFacebookのドキュメントでこれを見つけた

このフィールドは、ユーザーが自分自身を表現するためのものです。 Pre-filling このフィールドは、ユーザ音声の真正性を侵食します。

+0

私はなぜそれが事実であるかわからない... PHPのFacebookの図書館で私は私たちのウェブサイトを使用してすべてのパラメータでこれらのメッセージを投稿することができます。それは私が同じことをさせていないios sdkです。 –

関連する問題