Creating an Open FB Open Object via the iPhone SDK

I am working on a music player for the iPhone, and I would like users to be able to send songs to their time frames. I have Facebook Connect running, and I registered Open Graph objects and actions using Facebook, but I cannot figure out how to create / send objects and actions from iOS.

Facebook gives me the following code, but I don’t know where to use it for their iOS SDK.

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# MYAPPNAME: http://ogp.me/ns/fb/MYAPPNAME#">
<meta property="fb:app_id"      content="xxxxxxxxxxxxxxx" /> 
<meta property="og:type"        content="MYAPPNAME:song" /> 
<meta property="og:url"         content="Put Your Own URL Here" /> 
<meta property="og:title"       content="Some Arbitrary String" /> 
<meta property="og:description" content="Some Arbitrary String" /> 
<meta property="og:image"       content="http://ogp.me/logo.png" /> 
+5
source share
4 answers

You do not publish Objects from the iOS SDK - you publish Actions through the SDK and refer to the URL of the object.

You are doing something similar to:

[[delegate facebook] requestWithGraphPath:@"me/YOUR_APP_NAMESPACE:YOUR_ACTION_NAME" andParams:[@"YOUR_OBJECT_URL" forKey:@"recipe"] andHttpMethod:@"POST" andDelegate:self];

Basically, you send POST to the Graph API using the standard iOS APIs.

, , : https://github.com/facebook/wishlist-mobile-sample

+3

( , /, ), Facebook OpenGraph iOS 5.x . .

, , - iOS, - Facebook. , - ( ) - , - , iOS ( Parse.com), , GUI, Facebook OpenGraph. ( , Heroku Parse - -, .)

, , -, FB OpenGraph.

.. iOS 6 , FB , Twitter iOS 5 (.. 30 ). , , .:)

0

, "OG Objects", / ( "" FB). "", API- Facebook. "" ( URL) OG, . OG (, , ..).

, "" OG , , -, backend. ! , , - ( OG), , (BaaS - ).

, FB: Parse ' , Parse.com, .... , , . Parse, , . " Kinvey, OG ( ) .

0

You cannot publish songs directly, you will need to post songs on your own server (or on a social network such as Soundcloud), and then postthose objects on Facebook. You can create objects on the fly, although with recent changes to the SDK, using:

NSMutableDictionary<FBOpenGraphObject> *object =
            [FBGraphObject openGraphObjectForPostWithType:@"yourns:yourtype"
                                                    title:title
                                                    image:imageDataIfAny
                                                      url:@"a URL that can be clicked"
                                              description:descriptionIfAny];
            //attach custom data
            object[@"data"] = @{
                               //any custom data of your object type comes here
                                };

You no longer need to put OG tags on a web page, but you still need a URL parameter that will lead the user to the web page when clicked.

0
source

All Articles