与iOS 6.0原生Facebook集成共享:“通过我的应用名称发布”? [英] Sharing with iOS 6.0 native Facebook integration: "Posted via my app name"?

查看:109
本文介绍了与iOS 6.0原生Facebook集成共享:“通过我的应用名称发布”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚通过ios 6将Facebook整合到我的应用程序中,但是在我的墙上发布时我有一个问题。只需通过ios应用发布。我想通过应用程序名称发布。我已经与Facebook签署了一个应用程序身份,并且我已经分配了这个应用程序号,但是我不知道如何将它与Facebook集成在一起。

I have just integrated facebook into my app via ios 6 but I have an issue when posting on my wall. It simply says "post via ios app". I want it to say "posted via the app name". I have made an app identity with facebook and I have the app number they have assigned but I am not sure how to integrate this with facebook integration.

以下是我的代码。如果有人可以帮忙,不胜感激。谢谢!

Below is my code. If anyone could help, it would be appreciated. Thanks!

{
NSString *message;
message= [[NSString alloc] initWithFormat:@"I've earned %@ points", [self retrieveScore]];

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {

    SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    [controller setInitialText:message];
    [controller addURL:[NSURL URLWithString:@"http://mysite"]];
    [self presentViewController:controller animated:YES completion:Nil];
    [message release];

    SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
        NSString *output= nil;
        switch (result) {
            case SLComposeViewControllerResultCancelled:
                output= @"Action Cancelled";
                NSLog (@"cancelled");
                break;
            case SLComposeViewControllerResultDone:
                output= @"Post Succesfull";
                NSLog (@"success");
                break;
            default:
                break;
        }
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [alert show];
        [alert release];
        [controller dismissViewControllerAnimated:YES completion:Nil];
    };
    controller.completionHandler =myBlock;
      }


推荐答案

更新 - 可以完成



所以 Digg for iOS 应用能够分享到Facebook而不使用帐户框架来获取用户权限...他们使用 UIActivityViewController 并将帖子显示为via Digg,我联系了Digg他们告诉我,这是一个手动过程,您必须将iOS应用程序发布在Apple App Store中,并且还可以在Facebook App Store中接受并发布您的Facebook应用程序。
那么Facebook可以通过这种方式手动处理两个链接。

UPDATE - it can be done

So the Digg for iOS app is able to share to Facebook without using the Accounts framework to get user permissions... They use UIActivityViewController and have the post appear as "via Digg", I contacted someone from Digg and they told me that it's a manual process, you must have your iOS app published in the Apple App Store and also have your Facebook application accepted and published in the Facebook App Store. Then Facebook can manually process linking the two in this way.

这个明显的缺点是 UIActivityViewController 意味着您可以从您的应用程序中分享,而无需与Facebook集成,不需要Facebook应用程序...但要获得通过您的应用程序名称,您将需要一个Facebook应用程序,Facebook将批准到自己的应用商店,一旦所有事情都活了,你需要联系开发者关系,将其全部链接起来。

The obvious downside to this is that UIActivityViewController meant that you can share from your app without any integration with Facebook, no need for a Facebook app... But to get "via Your App Name" you will need a Facebook app that Facebook will approve into their own app store, once everything is live, you'll need to contact developer relations to link it all up.

请注意,我的其他答案(我以前的回答)是正确的,解决方案是Facebook可以为您做的手动过程,您的iOS代码不应受到影响。

Note that the rest of my answer (my previous answer) is correct, the solution is a manual process that Facebook can do for you, your iOS code shouldn't be affected.

您想要的本机Facebook集成实际上是作曲家视图控制器。这是通过使用服务类型为 SLServiceTypeFacebook SLComposeViewController 获得的。

The native Facebook integration you want is actually the composer view controller. This is obtained by using the SLComposeViewController class with service type SLServiceTypeFacebook.

此课程仅提供单向通讯,如您所知,您是通过点击发布按钮来确认任何墙壁信息的人员。此视图控制器由iOS系统所有,而不是您的应用程序。并且通过与此组合视图控制器交互,您实际上绕过了您的应用程序。

This class only provides a one way communication and as you notice, you are the one confirming any wall posts by tapping the Post button. This view controller is owned by the iOS system, not your app. And by interacting with this compose view controller you are actually bypassing your application.

用户喜欢这样做,因为它给了他们安全。

Users like to do this because it gives them security.

除非您的应用程序仅通过更深入的双向Facebook集成才能运行,您应该使用 SLComposeViewController (更深入的集成意味着您的应用程序需要您的朋友列表或现有的墙上帖子,专辑等)。

Unless your application functions only by a deeper, two-way Facebook integration you should use the SLComposeViewController (deeper integration meaning your app needs your friends list or existing wall posts, albums etc...).

为了让您的应用程序发布的帖子在Facebook上显示通过xxxx而不是通过iOS,您需要通过 SLRequest 类与Facebook进行交互。为了做到这一点,除了 Social.framework 之外,您还必须与 Account.framework 进行交互。

In order for a post originating from your application to appear on Facebook with the "via xxxx" and not "via iOS", you need to interact with Facebook via the SLRequest class. In order to do this you must also interact with the Account.framework in addition to Social.framework.

它类似于以前使用过的Facebook iOS SDK(并且仍然可以使用)在设置方面,您可以参考设备的帐户存储,您要求Facebook帐号并发送您的Facebook应用程序ID和一系列权限。

It resembles the previous Facebook iOS SDK previously used (and still can use) in terms of setting it up, you get a reference to the Accounts store of the device, you request for Facebook accounts and send your Facebook app ID and an array of permissions.

如果被授予,您可以通过 SLRequest 类与Facebook Graph API进行交互。通过在这个庄园发贴到你的墙上,你将拥有所需的通过xxx。

If granted you may then interact with the Facebook Graph API via the SLRequest class. By posting to your wall in this manor you will have the desired "via xxx".

要使用它,请查看 SLRequest的文档

请注意,您有责任创建自己的在这种情况下,您可以查看此视图​​。

Please note that you are responsible for creating your own compose view in this case.

您当然可以从本地界面启动自己,还可以查看iPhoto的iOS应用程序,尝试使用该应用与Facebook共享Facebook,您将注意到它请求与您的Facebook帐户交互的权限(使用 SLComposeViewController 时不会发生的事情),然后提供非常接近 SLComposeViewController 为Facebook发布文章。

You can of course inspire yourself from the native UI, also check out iPhoto's iOS app, try sharing to Facebook with that app, you will notice it requests permission to interact with your Facebook account (something that does not occur when using SLComposeViewController), it then presents something very close to the SLComposeViewController for Facebook post composing.

但是如果你看得更近,你会注意到它是不一样的。这也是Twitter和他们的本地应用程序与本地集成。他们有自己的组合视图,很有趣的是注意到他们使用原生的iOS集成(Apple框架)。我们知道这一点,因为去设置>隐私> Twitter,你可以看到Twitter应用程序是使用设备上的Twitter帐户的授权应用程序。

But if you look closer you'll notice it is not the same. This also goes for Twitter and their native app vs native integration. They have their own compose view, it's really interesting to note they use the native iOS integration (the Apple frameworks). We know this because going to Settings > Privacy > Twitter you can see Twitter app is an authorised app using the Twitter account(s) on the device.

同样的Facebook

Same goes for Facebook.

如果您没有获得权限,那么您无法通过应用程序发布,也就是通过myApp。

If you don't get permission then you have no way of publishing as your app - aka "via myApp".

对不起,让我失望,我也一直在寻找一种将 ACAccount 集成到 SLComposeViewController 但是找不到方式。这是一个耻辱,因为本地UI是甜蜜的。

Sorry to let you down, I also had been searching a way to integrate an ACAccount into the SLComposeViewController but couldn't find the way either. Which is a shame... because the native UI is sweet.

这篇关于与iOS 6.0原生Facebook集成共享:“通过我的应用名称发布”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆