[英]facebook content looks diffrent in wall and home page , after posting the content from iOS app using facebook sdk of iOS
在使用iOS的facebook sdk从iOS应用程序发布内容后,Facebook内容在墙和主页中看起来有所不同,
二手代码:我们使用以下代码在Facebook墙上发布数据。
[NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Found this app ", @"message",
@"AppName", @"name",
@"App Title", @"caption",
@"Description data", @"description",
@"Link URL", @"link",
@"Image URL", @"picture",nil];
// create the connection object.
FBRequestConnection *newConnection = [[[FBRequestConnection alloc] initWithTimeout:kRequestTimeoutInterval] autorelease];
// create the request object, using the fbid as the graph path as an alternative the request* static methods of the
// FBRequest class could be used to fetch common requests, such as /me and /me/friends
FBRequest *request=[[[FBRequest alloc] initWithSession:activeSession
graphPath:@"me/feed"
parameters:params
HTTPMethod:@"POST"] autorelease];
详细信息:当我们要发布此数据并链接网址时,内容在主屏幕和个人资料屏幕中看起来不同。
相反,od App Name在主页中显示链接URL标题,但在配置文件页面中显示正确的内容,如App Title。 它只发布在iOS应用程序中,从Android应用程序看起来不错。
请帮助我tikamchandrakar@gmail.com或tikam.chandrakar@xymob.com如果有任何事情不清楚请告诉我。 谢谢
试试这段代码。 它对我来说很完美 -
// Helper method to request publish permissions and post.
- (void)requestPermissionAndPost {
[FBSession.activeSession requestNewPublishPermissions:[NSArray arrayWithObject:@"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
if (!error && [FBSession.activeSession.permissions indexOfObject:@"publish_actions"] != NSNotFound) {
// Now have the permission
[self postOpenGraphAction];
} else if (error){
// Facebook SDK * error handling *
// if the operation is not user cancelled
if (error.fberrorCategory != FBErrorCategoryUserCancelled) {
// [self presentAlertForError:error];
}
}
}];
}
// Creates the Open Graph Action.
- (void)postOpenGraphAction {
NSString *pageId = @"";
if ([pageIdArray count] > 0) {
pageId = [[pageIdArray objectAtIndex:0] objectForKey:@"page_id"];
}else{
pageId = @"";
}
//http://mistoh.com/mistohws/CategoriesIcon/CategoryIcon_%1$s.png
[FBRequestConnection startWithGraphPath:@"me/feed"
parameters:@{
@"link":@"http://mistoh.com/mistohws/CategoriesIcon/CategoryIcon_1.png",
@"message":[NSString stringWithFormat:@"I just shared a Mistoh at %@",self.mistohNameStr],
@"place":[NSString stringWithFormat:@"%@",pageId],
@"name":[NSString stringWithFormat:@"%@",self.mistohNameStr],
@"description":[NSString stringWithFormat:@"%@",self.mistohDescStr],
@"address":[NSString stringWithFormat:@"%@",self.mistohAddressStr],
@"tags":[NSString stringWithFormat:@"%@",self.selectedFriendsStr]
}
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
//verify result
if (!error) {
[[[UIAlertView alloc] initWithTitle:@"Shared Mistoh Successfully!!"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil]
show];
}else{
[[[UIAlertView alloc] initWithTitle:@"Error"
message:@"Error while sharing mistoh with friends."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil]
show];
NSLog(@"Error : %@",[error description]);
}
}];
}
它在Facebook墙和时间线上看起来不错。 谢谢..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.