除了来自用户的小消息blurb('message'参数)之外,每个参数都会正确发布。为什么这部分帖子没有在facebook上显示?我设置参数错了吗? 请查看此图片,看看我正在谈论的帖子的哪一部分: https://skitch.com/hahmadi82/8uecw/brenton-joynin
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 :(得分:0)
首先,"怎么来"是孩子们说的。大声抱歉。其次,这是发布到另一个用户的Feed。所以你应该检查他们的墙壁上的帖子,而不是你的墙。
我相信你必须包括描述。这是我们使用的代码。好像您的代码应该有效。您还应该检查以确保您的%@ formatter中有正确的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];
答案 1 :(得分:0)
你的Facebook sessionValid?询问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
登录并查看是否被呼叫....如果不是我有一个非常类似的问题...我会指导你完成
所以我的问题是我应该在App Delegate中声明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];
}
}
答案 2 :(得分:0)
如果您的意思是发布带有帖子对话框的消息实际上是不可能的,我遇到了同样的问题,我在Facebook文档中发现了这个
此字段供用户表达自己。预灌装 该字段侵蚀了用户语音的真实性。