Like button in iOS application

孤街浪徒 提交于 2019-12-17 06:31:44

问题


Does anybody know how to place Facebook "like" button into iOS application? I've tried the method described in this blog post. But I do not really like this method, because its ugly Login dialog. And, what is more important, it makes user login twice. For example, user wants post a message to his wall if he isn't logged in I call standard FBLoginDialog, after that user posted a message he may want push "like" button and he have to login again - it is really bad user experience.

How to be? How can I give user "like" feature in my iOS app?


回答1:


That is actually the only way to do it. There is no special iOS like button. However, the good news is that just today Facebook announced single sign in support for mobile apps. This should remove some of the burden the user faces to log in to facebook.




回答2:


It seems there is an agreement on not being able to do this. This question shows you can, as does the FB Graph API documentation:

You can comment on or like any object that has a /comments or /likes connection by posting to https://graph.facebook.com/OBJECT_ID/comments and https://graph.facebook.com/OBJECT_ID/likes, respectively.

Unfortunately, according to this question you can’t like a page.




回答3:


I like using ShareKit: http://www.getsharekit.com/

It's not exactly what you're looking for, but still...




回答4:


The only way supported by Facebook on any platform (web, mobile, etc) is from their iFrame code. From iOS, that means embedding a UIWebView into your application with the iFrame code. Note that it does require them to login via Safari.




回答5:


- (void)addLikeButton{
[FBSettings enableBetaFeature:TRUE];
[FBSettings enablePlatformCompatibility:NO];
 _like = [[FBLikeControl alloc] init];
_like.frame = CGRectMake(60,12,200,33);
_like.likeControlAuxiliaryPosition = FBLikeControlAuxiliaryPositionInline;
_like.likeControlHorizontalAlignment = FBLikeControlHorizontalAlignmentLeft;
_like.objectID = @"https://www.facebook.com/pages/Strana-Gapra/1377227779244834";
_like.likeControlStyle = FBLikeControlStyleStandard ;
[_like addTarget:self action:@selector(onSelect:) forControlEvents:UIControlEventValueChanged];
[self.likeView addSubview:_like];
[self performSelector:@selector(getLikeSubviews) withObject:nil afterDelay:0.6];

}



来源:https://stackoverflow.com/questions/4087660/like-button-in-ios-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!