Posting message along with an image on Facebook [duplicate] - iphone

This question already has an answer here:
Closed 11 years ago.
How do I post a message on Facebook while uploading an image on Facebook?
In my project I'm using FBFeedPost for uploading images on Facebook and is working fine, but I have to post a message along with the image.

I recommend ShareKit, easily setup and supporting the facebook features you requested.
After installing authorization is done with just:
SHKSharer *service = [[[SHKFacebook alloc] init] autorelease];
[service authorize];
After that it's
SHKItem *item = [SHKItem image:myImage title:#"Look at me!"];
[SHKFacebook shareItem:item];
for an image and for text:
SHKItem *item = [SHKItem text:text];
[SHKFacebook shareItem:item];

Related

Facebook Photo Size in iOS sdk

Right now with the Facebook iOS sdk, I am pulling images off the wall. but I need to analyze the photo and determine the height and width of the photo.
How would I go about doing this?
I know that this is an old question which has been answered, but since the accepted answer is very unclear and because this might help others that have the same problem as you had:
Given that the images that you pull off the wall are turned into UIImage objects before you display them, then you can just do the following to easily get the height and width of each object:
Full code example:
NSData* imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:yourimageurlhere]];
UIImage* image = [[[UIImage alloc] initWithData:imageData] autorelease];
[imageData release];
NSLog(#"Height : %0.1f", image.size.height);
NSLog(#"Width : %0.1f", image.size.width);
when you issue a call to GraphAPI photo object, you get dimensions in the response: https://graph.facebook.com/98423808305
is it what are you looking for?

How can I add a specific email recipient to my sharekit item?

So, I'm using sharekit to share some text. I need to be able to send the email to a pre-defined recipient. How can I set the mail recipient to the sharekit item?
Sharekit has now implemented this. You can use the example below.
NSURL *url = [NSURL URLWithString:#"Your URL"];
SHKItem *item = [SHKItem URL:url title:#"Your title" contentType:SHKURLContentTypeUndefined];
NSArray *recipientArray = [NSArray arrayWithObjects:#"mail#example.com",nil];
[item setMailToRecipients:recipientArray];
[SHKMail shareItem:item];
I found the answer here:
ShareKit
UPDATE: Sharekit has an update that takes care of this now. See the newly accepted answer.

How to implement sharing via Twitter, mail & Tumblr using ShareKit

I am trying to use ShareKit to implement sharing via Twitter, mail & Tumbler but I am unable to make them work correctly.
I implemented the following code on view load,
SHKItem *item;
item=[SHKItem image:[UIImage imageNamed:#"icon2.png"] title:#"Praveen"];
[SHKFacebook shareItem:item];
Please help me..
Try these following lines ;) it works for me :)
NSString *imageName=[NSString stringWithFormat:#"marriage0.jpg"];
NSString *message=[NSString stringWithFormat:#"%#",self.myMessage.text];
UIImage *image =[UIImage imageNamed:imageName];
SHKItem *fbItem = [SHKItem image:image title:message];
[SHKFacebook shareItem:fbItem];

ShareKit for Facebook in iPhone application

I can't get ShareKit to work. I dragged ShareKit into my app with checked copy option. I also updated the shkconfig file with my Facebook key, secure key, and used the following code:
SHKItem *item = [SHKItem text:#"Praveen Kumar Tripathi"];
SHKFacebook *faceBook=[SHKFacebook shareItem:item];
[faceBook share];
in viewDidLoad.
But I'm not able to see Facebook screen. I'm seeing a blank screen.
You weren't completely clear, so I'm not sure what your asking, but it sounds like you want to show a facebook login at launch. The way you do that is like this:
First, #import "SHKFacebook.h"
then in your button, put then in the viewDidLoad:
SHKItem *item;
this creates the sharekit item
then:
NSURL *url = [NSURL URLWithString:#"http://itunes.apple.com/us/app/...?mt=8"];
put the link to your app here. This link is so if someone clicks on the Facebook post, they will be directed to the iTunes store to download your app.
Then set the basic text for your post. This text is set by you. The user Cannot change this text. (Obviously this is what I do, you can make this text anything you want)
item = [SHKItem URL:url title:[NSString stringWithFormat:#"I'm playing someGame on my iPhone! My Highscore is %i, think you can beat it?", highScoreInt]];
Then set up the post like this:
item = [SHKItem URL:url title:#"Share Me!"];
finally show the item:
[SHKFacebook shareItem:item];
I hope this helps.

posting UIImage to facebook along with other text

i'm trying to post an image on facebook using the following code.
FBStreamDialog* dialog ;
if([FBSession session].isConnected)
dialog = [[[FBStreamDialog alloc] initWithSession:[FBSession session]] autorelease];
else
dialog = [[[FBStreamDialog alloc] initWithSession:session] autorelease];
dialog.attachment = [NSString stringWithFormat:#"{\"name\":\"%#\",\"media\":[{\"type\":\"image\",\"src\":\"%#\"}]}", strEventStatus,eventImg];
[dialog show];
Does the media tag have any other property apart from src which would take and image in form of NSData? how do i post the image otherwise?
While you are linking the attachment property for a Image the source should be a URL.. I dont think You can post a UIImage by using attachment.. One solution is you can have a webservice for posting the image in your server and then give that URL when you are posting.
I dont know which Facebook API you are using..
This what i did to upload a image by using Facebook Graph API
UIImage *img = [UIImage imageNamed:#"myImage.png"];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, #"picture",
nil];
//facebook is a facebook Obj which I initialized before
[facebook requestWithMethodName:#"photos.upload"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
I have no knowledge of the Facebook API you are using, but it would seem Image SRC would imply that the image is already somewhere on the web.
Have you considered uploading the image to a server somewhere and using the SRC of the image as a URL?
I hope this helps!
You can directly take a UIimage and upload via the code used by BuildSucceeded, you no longer need to forward the image to a server and link via URL. You can also call the image from a UIimageview, camera or library.