i'm using facebook ios sdk 3.5, now following the instructions found here https://developers.facebook.com/docs/tutorials/ios-sdk-games/open-graph/ and the code found in the FriendSmasher, i am trying to post a score. However, i'm not seeing any results on my feed.
Thanks
this is my test code for our game:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: #"100", #"score", nil];
NSLog(#"Posting new score of 100");
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:#"%llu/scores", myFBID] parameters:params HTTPMethod:#"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(error){
NSLog(#"AN ERROR HAS OCCURED: %#", error.debugDescription);
}
else
NSLog(#"Score posted");
}];
the request permissions is done using the deprecated function openActiveSessionWithPermissions with email and publish_actions passed
You can check your Activity Log on the desktop for score stories. You'll see stories if you get a high score for example, so you can test that. The fact that a score was posted does not show up in News Feed. The stories that may show up when a score is posted are stories like passing stories (you passed a friend) or high score stories. You can always check these types of stories in your Activity Log.
Related
I'm using this code to upload a photo on the Facebook user wall but the result dictionary return to me only photoid and postid, i need to know the permission level of the post that i have just share (during sharing process in native app the user can select Public,friends,only me...), There a way to know this permission?
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:#"", #"message", nil];
[params setObject:Picture forKey:#"source"];
[FBRequestConnection startWithGraphPath:#"me/photos"
parameters:params
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (error)
{
//showing an alert for failure
}
else
{
//showing an alert for success
NSString *phoId=[NSString stringWithFormat:#"%#",[result valueForKey:#"id"]];
NSString *PostId=[NSString stringWithFormat:#"%#",[result valueForKey:#"post_id"]];
}
}];
You can do another Graph API Call using the post id of the photo you have just uploaded. The specific field you want to ask for is called 'privacy'. This field is an object. One of its properties is 'value', which can be one of the following:
Everyone
All Friends
Friends of Friends
Self
Custom
From this, you can check the privacy people have specified on your post and adjust accordingly.
More info here: https://developers.facebook.com/docs/graph-api/reference/v2.3/post
I'm trying to do something that seems to be an order of magnitude more difficult than necessary.
I've got an iOS app that is written against a Parse backend. Our app's users can create items to store and they can sometimes generate alerts for these items.
I want to post a simple alert for a user to Facebook.
I've read quite a bit on the Facebook website about integrating Facebook into iOS, but their documentation is confusing and I've seen more than one person on StackOverflow mention that their iOS code is at least sometimes flawed.
Basically, the custom story will include the following items:
Story Title
Story Description (usually not very much text in here)
One or more pictures (I'd settle for 1, but I'd love to be able to post multiples)
If possible, a user-supplied GPS location.
I will admit up front that I'm a developer who is learning Facebook for work purposes, and I am far from being an expert on Facebook.
When I play around in the Facebook app, I can add a status update that can include:
Text
Picture(s)
Friends
What I'm doing
Where I am (or some location)
However, in the Facebook SDK, there appears to be only the following 2 options for posting a status update:
startForPostStatusUpdate:completionHandler:
startForPostStatusUpdate:place:tags:completionHandler:
If I'm missing something there, please let me know.
Secondly, I'm trying to follow Facebook's documentation and sample code to do the following sequence of events:
Upload and stage an image resource
Create an object (in my app, I've registered an "alert" object)
Create an action (in my app, I've registered a "post" action)
Here's the code that I've pieced together from Facebook's website (comments are mostly from other people's code, not my own):
- (void)postToFacebookWithAlert:(PFObject *)alert image:(UIImage *)image {
// Stage the image
[FBRequestConnection startForUploadStagingResourceWithImage:image completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error != nil) {
// See: https://developers.facebook.com/docs/ios/errors
} else {
// Package image inside a dictionary, inside an array like we'll need it for the object
NSArray *image = #[#{#"url": [result objectForKey:#"uri"], #"user_generated" : #"true" }];
// Create an object
NSString *caption = // user-generate content
NSMutableDictionary<FBOpenGraphObject> *alert;
alert = [FBGraphObject openGraphObjectForPostWithType:#"<myapp>:alert"
title:caption
image:image
url:nil
description:alert[#"subtitle"]];
alert.provisionedForPost = YES;
// Post custom object
[FBRequestConnection startForPostOpenGraphObject:alert completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error != nil) {
// An error occurred
} else {
NSMutableDictionary<FBGraphObject> *post = [FBGraphObject graphObject];
post[#"alert"] = result[#"id"];
[FBRequestConnection startForPostWithGraphPath:#"me/<myapp>:post" graphObject:post completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSLog(#"startForPostWithGraphPath:graphObject:completionHandler:");
if (error != nil) {
// An error occurred
NSLog(#"Encountered an error posting to Open Graph: %#", error);
} else {
NSLog(#"OG story posted, story id: %#", result[#"id"]);
}
}];
}
}];
}
}];
}
I've actually gotten this code to work one time. I'm logged in as my own personal Facebook account. If I go to my activity log, I can see the items that I'm trying to post. If I go to my photos, I can see the photos that I'm trying to upload. If I view my profile from my wife's app/account, it doesn't show up.
Does anyone have working code that does what I want?
Maybe you need to set "fb:explicitly_shared" to "true" and it should be reviewed by Facebook.
After your review pass, you can add the option like below.
[post setObject:#"true" forKey:#"fb:explicitly_shared"];
I am trying to post on users wall using ios app by using FB New graph API 3.17.1.But when I post using the graph path me/photos, it will create an bunch of post at one location instead of posting the images as separate story.
I did lot of R&D and found this Post photo on user's wall using Facebook iOS SDK
I used below method to post on user's wall
NSMutableDictionary* postParams = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
#"<Image URL>", #"picture",
#"Facebook SDK for iOS", #"name",
#"build apps.", #"caption",
#"testing for my app.", #"description",
nil];
[FBRequestConnection startWithGraphPath:#"me/feed"
parameters:postParams
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection, id result,NSError *error)
{
if (error)
{
NSLog(#"Error in uploading the photo %#",error);
}
}];
This method does paste the image on user's wall but for this image has to be uploaded somewhere on internet and we have supply the URL of same.And additionally it makes image visibility very less compared to image posted using me/potos.
[FBRequestConnection startWithGraphPath:#"me/photos" parameters:params
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection*connection, id result, NSError *error)
{
NSLog(#"Error : %#",error);
NSLog(#"%#",result);
}];
I used above method but it will group the photos into bunch and make the album on the users wall after 3-4 post. And additionally it has limitation of max 25 post per app per day. So this method is negligible.
Please let me know any alternative way, if anyone has used.I would be very thankful.
I am using facebook-ios-sdk-3.11.1 and Xcode 5 and i need to support ios 5,6,7
Old Facebook Doc for checkin
New Facebook Doc for checkin
From this info i have found following code needs to be implemented
[FBRequestConnection startWithGraphPath:#"/me/checkins"
parameters:nil
HTTPMethod:#"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
NSLog(#"result %#",result);
}];
Outuput:
result {
data = (
);
}
I am getting no results even though i have checkin to one place from my facebook account
And how can we get data of friends checkin of user's friends as well
I am using facebook sdk and need to share details to facebook timeline. I am using the following api call.
[FBRequestConnection startWithGraphPath:#"/feed"
parameters:dictionary
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (!error) {
[VBUtility showAlertWithTitle:#"Facebook" message:#"Deal details posted successfully"];
}
}];
The story is published on facebook, not at user's timeline but user's newsfeed (The document tells this method does - posts and links published by this person or others on their profile.). I have also tried with /home method call. While I tried with the built in facebook share,
SLComposeViewController *fbPost = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
it is perfectly published to user's timeline as well as in news feed. I have configured the app in the developer.facebook.com. Do I need to mention any permissions here. Does any one can help me finding the mistake?
Permission Request,
NSArray *permissions = [[NSArray alloc]initWithObjects:#"publish_actions",#"user_birthday",#"publish_stream",#"user_about_me",#"email",#"basic_info",nil];
The parameters passed are,
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
app_id, #"app_id",
name,#"name",
caption, #"caption",
description,#"description",
link, #"link",
picture, #"picture",
#"1",#"fb:explicitly_shared",
nil];
Try this,
[FBRequestConnection startWithGraphPath:#"me/feed"
parameters:dictionary
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (!error) {
[VBUtility showAlertWithTitle:#"Facebook" message:#"Deal details posted successfully"];
}
}];
I changed little bit from your code. Change your path as #"me/feed". I hope, this may help you.