Sharing with Facebook integration iOS 6.0: "Sent via my application name"?

I just integrated facebook into my application via ios 6, but I have a problem when posting on the wall. It just says “message via ios app . I want it to say ” sent through the name of the app . I made an application identifier with facebook, and I have the application number that they assigned, but I'm not sure how to integrate it with facebook integration.

Below is my code. If anyone could help, that would be appreciated. Thank!

{ 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; } 
+44
ios objective-c facebook xcode ios6
Sep 22 '12 at 20:51
source share
3 answers

UPDATE - it can be done

So, the Digg application for iOS can be shared with Facebook without using the account structure to obtain user rights ... They use the UIActivityViewController and have a message appear as “via Digg”, I contacted someone from Digg and they told me that This is a manual process. You must have your iOS app published to the Apple App Store, and your Facebook app accepted and published to the Facebook App Store. Facebook can then manually handle linking the two in this way.

The obvious drawback of this is that the UIActivityViewController means that you can share your application without any integration with Facebook, there is no need for a Facebook application ... But to get "through your application name", you need a Facebook application that Facebook approve in your own app store, once everything is live, you will need to contact the developers to link it all.

Please note that the rest of my answer (my previous answer) is correct, the decision is a manual process that Facebook can do for you, your iOS code should not be affected.




Previous answer and workaround

Native integration with Facebook, in fact, is a composer presentation controller. This is achieved using the SLComposeViewController class with the SLServiceTypeFacebook service SLServiceTypeFacebook .

This class provides only one-way communication, and, as you noticed, you confirm the presence of any wall posts by clicking the "Publish" button. This view controller belongs to the iOS system and not to your application. And, interacting with this controller compiler, you actually bypass your application.

Users like to do this because it gives them security.

If your application functions only through deeper two-way integration with Facebook, you should use SLComposeViewController (deeper integration means that your application needs your friends list or existing wall posts, albums, etc.).

In order for the message that appears from your application to appear on Facebook using "via xxxx" rather than "via iOS", you need to interact with Facebook through the SLRequest class. To do this, you must also interact with Account.framework in addition to Social.framework .

It resembles the previous Facebook IOS SDK previously used (and can still use it) in terms of its configuration, you get a link to the device account storage, you request Facebook accounts and send your Facebook application identifier and an array of permissions.

If provided, you can then interact with the Facebook API through the SLRequest class. Sending to your wall in this estate, you will receive the desired "through xxx".

To use this, check out the documentation for SLRequest .

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

You can, of course, inspire yourself on your own user interface, as well as watch the iPhoto iOS application, try to share with Facebook with this application, you will notice that it asks permission to interact with your Facebook account (something that does not occur when using SLComposeViewController ), then it presents something very close to the SLComposeViewController for posting to Facebook.

But if you look closer, you will notice that this is not the same. This also applies to Twitter and their native application versus native integration. They have their own presentation, it is very interesting to note that they use the built-in iOS integration (Apple framework). We know this because by going to Settings> Privacy> Twitter, you can see that the Twitter application is an authorized application that uses Twitter accounts on the device.

The same goes for Facebook.

If you have not received permission, you have no way to publish your application - aka "through myApp".

Sorry to let you down, I was also looking for a way to integrate ACAccount into the SLComposeViewController , but couldn't find a way. What a shame ... because the native user interface is sweet.

+70
Sep 26 '12 at 15:28
source share

I ended up using a custom Facebook framework with a new SDK for Windows 3.1. Facebook Compose View

The original is here: facebook compose view . I just fixed a few minor warnings and updated with the new FB SDK 3.1.

Using:

 DEFacebookComposeViewControllerCompletionHandler __block completionHandler = ^(DEFacebookComposeViewControllerResult result) { [self dismissViewControllerAnimated:YES completion:nil]; switch (result) { case DEFacebookComposeViewControllerResultCancelled: NSLog(@"Facebook Result: Cancelled"); break; case DEFacebookComposeViewControllerResultDone: NSLog(@"Facebook Result: Sent"); break; } }; DEFacebookComposeViewController * compose = [[DEFacebookComposeViewController alloc] init]; [compose setInitialText:self.shareText]; [compose addImage:self.shareImage]; [compose addURL:self.shareURL]; [compose setCompletionHandler:completionHandler]; [self presentViewController:compose animated:YES completion:^{}]; 

Setup:

  • Open the project and do a clean build.
  • Go to the $PROJECT_FOLDER\build\Debug-iphonesimulator and drag both FBComposeView.framework and FBComposeView.bundle into your project.

Note. Be sure to use the Debug-iphonesimulator . This is a fat binary. enter image description here

+13
Sep 26 '12 at 18:21
source share

We solved a similar problem with the integration of iOS 5 Twitter, and the result:

When you post to Twitter using the dev assembly or through a simulator, it will almost always display on Twitter as “via iOS”. As soon as your application is approved and you publish it from the AppStore assembly, it should appear in the form of the message “YourAppName on iOS” with a link to the appstore application page.

original source (discussion of the problem with ShareKit)

I believe that Apple is doing the same with Facebook and other social services.

EDIT: Unfortunately, this only really worked with Twitter.framework. I think the best explanation and answer is Daniel above. Maybe it's radar time, so Apple knows what we want.

Examples of using SLRequest with Facebook are in this SO question

EDIT2: filed a radar error ID: # 12980058. I hope they listen ...

+3
Nov 15 '12 at 15:37
source share



All Articles