我想把推特和脸书整合成一个使用Cocos2D的游戏。我只想要一些简单的东西,比如在that上发布“我得了xxx分”,在Facebook页面上发布类似的消息,等等。我已经看到了很多让我的生活变得更容易的库-- ShareKit,AddThis等等--但我也读到过人们说它们并不是那么容易,不受支持,等等。
我可以去获取facebook和twitter SDK,并将它们集成到其中,但我想知道是否有人对我遗漏的东西有什么建议。我需要支持iOS4和5,所以我想这个库应该使用iOS5中内置的twitter特性。
对此有什么建议或评论吗--也许我错过了一些非常明显的东西?
发布于 2012-03-02 20:08:01
1)对于Facebook,当然可以使用facebook SDK并配置https://github.com/facebook/facebook-ios-sdk。但你可能会在其中得到很多问题。最好阅读facebook网站上给出的文档,然后去做。如果您对此有任何疑问,请随时提出。
2)对于Twitter,可以使用ios5内置的twitter框架。这很简单。尝试在其中使用tweet sheet。它将给ios5的用户带来良好的体验和一致性。但您还必须集成MGTwitterEngine( https://github.com/mattgemmell/MGTwitterEngine )才能支持ios4及其早期版本。这有点困难。
希望你拿到了。
发布于 2012-03-02 20:08:08
您只需插入以下代码行即可在Facebook上进行分享。对于twitter,我认为没有这么简单的方式存在。
NSString *urlString = @"any url";
NSString *title = @"My score is 999";
NSString *shareUrlString = [NSString stringWithFormat:@"http://www.facebook.com/sharer.php?u=%@&t=%@", urlString , title];
shareUrlString = [shareUrlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [[NSURL alloc] initWithString:shareUrlString];
[[UIApplication sharedApplication] openURL:url];
[url release];发布于 2013-02-13 19:02:41
您可以使用以下代码在twitter上进行分享
twt = [[TWTweetComposeViewController alloc] init];
[twt setInitialText:@"Scorred 1000"];
[twt addURL:[NSURL URLWithString:@"url"]];
twt.completionHandler = ^(TWTweetComposeViewControllerResult result) {
switch (result) {
case TWTweetComposeViewControllerResultCancelled:
[twt dismissModalViewControllerAnimated:TRUE];
break;
case TWTweetComposeViewControllerResultDone:
//[self.navigationController popViewControllerAnimated:NO];
[self.navigationController popViewControllerAnimated:TRUE];
break;
default:
break;
}
[twt dismissModalViewControllerAnimated:TRUE];
};https://stackoverflow.com/questions/9532622
复制相似问题