iOS Post to Facebook shows m.facebook.com - ios

My iOS app is posting an in-app post of ours from our app to Facebook using the Social framework and the following code.
It successfully posts to Facebook and correctly deep-links back into our application. The issue is that when this post is viewed on the Facebook iOS mobile app, instead of displaying the post's caption or description, we are seeing "m.facebook.com" as shown in this screenshot. We'd like to remove or replace "m.facebook.com" with either caption, description, or our site's root URL.
I"m guessing this "m.facebook.com" URL root is coming from the deep link URL, which is "https://m.facebook.com/apps/(our-app)/?deeplink=postId:(post-id)". We want it to deep link, but don't want "m.facebook.com" to be displayed.
Any advice? Thanks.
NSString *deepLink = [NSString stringWithFormat:#"https://m.facebook.com/apps/%#/?deeplink=postId:%i",FACEBOOK_APP_NAMESPACE,self.post.postId.intValue];
captionString = [NSString stringWithFormat:#"%# : %#", parentCategory.name, category.name];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.post.name, #"name",
captionString, #"caption",
self.post.details, #"description",
deepLink, #"link",
nil];
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodPOST
URL:feedURL
parameters:params];

Related

Video uploading issues using Facebook IOS app for other users

I uploaded video from using Facebook latest sdk its works fine. I have created in ios app in Facebook developer account. Still my app in testing mode. My app was not published in app store. I have tested with my facebook account video was uploaded to my facebook account . My app status was in live. I tried with my friend account below error came all the time. Please help me how to make works with other users.
i have used code below for video uploading
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"sample" ofType:#"mov"];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSString* videoName = [filePath lastPathComponent];
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:#"testing from ios app" forKey:#"description"];
[params setObject:videoData forKey:videoName];
[FBRequestConnection startWithGraphPath:#"me/videos"
parameters:params
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
}];
In apple developer account only showing approved for email,public_profile,user_friends.
permissions:(
"public_profile"
)>, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 200;
message = "(#200) Requires extended permission: publish_actions";
type = OAuthException;
};
};
code = 403;
}}
It means that you need request for publish_actions permission before upload. See Facebook Login for iOS, search for Checking for permissions.

Facebook feed dialog , post to wall , caption out off frame

i am using newest Facebook SDK from https://github.com/facebook/facebook-ios-sdk
and trying use feed dialog to Post to wall , the caption are out off the dialog frame.
it missing some word so i can't read whole caption, like this:
http://www.freeimagehosting.net/66oyf (sorry i can't post image on stack overflow yet since my reputation is too low.)
here is the code:
NSMutableDictionary *param = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[Utility getFBIconUrlHref], #"link",
[Utility getFBIconUrlSrc], #"picture",
name, #"name",
_bookName, #"caption",
#"description" , #"description", nil];
[_fb dialog: #"feed"
andParams: param
andDelegate:self];

Upload image to facebook using default dialog

I'm trying to upload an image to facebook using the iOS SDK from Facebook.
To upload an image, I'm doing following:
-Upload image to a private server in order to get the image URL.
-Open facebook dialog with "feed" in order to upload a comment to facebook wall.
My goal is to avoid using a private server to upload the picture and get the URL, in order to upload the image to facebook directly from iPhone.
I've been googling and I found several solutions to upload images directly to facebook, but is without using the default dialog that includes the SDK.
Is any way to upload images directly from device, using the FB dialog object? Is not an option for me to make the Views to replace the dialog.
Thanks in advance.
As far this is my code to publish on facebook:
+(void)composeFacebookWithImageUrl:(NSString *)imageURL image:(UIImage *)image delegate:(id)delegate
{
Facebook *_facebook;
_facebook = [[[Facebook alloc] initWithAppId:kAppId andDelegate:delegate] autorelease];
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
#"Always Running",#"text",#"http://itsti.me/",#"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
#"Ragdoll", #"name",
#"The Ragdoll maker app", #"caption",
#"Share with your friends", #"description",
#"http://www.im2.es/", #"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Share on Facebook", #"user_message_prompt",
actionLinksStr, #"action_links",
attachmentStr, #"attachment",
#"touch",#"display",
imageURL, #"picture",
nil];
[_facebook dialog:#"feed"
andParams:params
andDelegate:delegate];
}
Thanks.
Have you looked into ShareKit? I'm using it to share images in my apps and it works great.
https://github.com/ShareKit/ShareKit

iOS Facebook Graph API Profile picture link

I am trying to retrieve the link to the profile picture...
So far the graph API call :
[facebook requestWithGraphPath:#"me/picture" andDelegate:self];
returns the image itself as Data. When I make the call :
[facebook requestWithGraphPath:#"me/picture" andDelegate:self];
I do get an array of picture with the link for each of them.
Is there anyway to get some sort of similar thing for the profile pic, at least just the link... Or is it not possible?
If someone has already been through this please let me know.
Cheers,
Sami.
make the graph request:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:#"picture",#"fields",nil];
[facebook requestWithGraphPath:#"me" andParams:params andDelegate:self];
then on request didLoad:
NSString *pictureUrl = [result objectForKey:#"picture"];
If you want additional fields, just add them to the params dictionary:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:#"id,name,picture",#"fields",nil];
After logged in you can get the profile picture with this link;
https://graph.facebook.com/userId/picture?width=640&height=640
Do you meen anything like the following?
NSString *fbuid = #"1234567890";
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:#"https://graph.facebook.com/%#/picture", fbuid]];
Or do you need the final url to which the link above redirects you? For the final url I guess you will need a proxy, something of this kind maybe.
UPDATE:
You can also get the link with FQL:
https://developers.facebook.com/blog/post/2012/04/11/platform-updates--operation-developer-love/

Adding a share link when using fbdialog to post to a users wall

I'm using FBConnect to post a link to a user's wall. I am using the FBDialog api instead of using graph paths:
[facebook dialog:#"feed" andParams:_params andDelegate:_delegate];
Everything posts correctly except when the wall is viewed, there is no share link, only the like and comment links. I've researched this and figured out that this appears to be unique to using FBDialog.
If the graph path method is used:
[facebook requestWithGraphPath:_path andParams:_params andHttpMethod:#"POST" andDelegate:_delegate];
the share link shows up.
To fix this, I have added a custom link using the actions parameter provided by FBDialog:
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
#"Share", #"name",
#"http:???", #"link",
nil],
nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
[params setObject:#"link" forKey:#"type"];
[params setObject:self.url forKey:#"link"];
[params setObject:self.title forKey:#"name"];
[params setObject:self.caption forKey:#"caption"];
[params setObject:actionLinksStr forKey:#"actions"];
This again, works correctly and creates a share link. The question I have is: What url do I use to share the wall post? Any ideas?
Thanks so much!

Resources