Facebook URL Scheme for iOS - post photo - iphone

There are many URL schemes that can be used for facebook on iOS.
Is it possible to use one of these URL schemes to post a photo to a fan page?
I was trying to use fb://publish/photo/(initWithUID:)/(aid:)/(pid:) and fb://upload/(initWithSource:)/profile/(uid:) without any luck.
I'm not sure what to use for the initWithSource:.
Has anyone had any success in doing this?

You can use ShareKit framework to share the images to Facebook.
All you need to do is simple as following.
SHKItem *item = [SHKItem image:myImage title:#"Title"];
SHKFacebook *sharer = [[[SHKFacebook alloc] init] autorelease];
[sharer loadItem:item];
[sharer share];
ShareKit is very useful and easy to use.

You can get some idea from here and then merge this code in your own code as per on your requirement Post Photos on fan page

Related

How to share a photo in iphone

Using the below code we can share a photo through available services on android.
Can anyone tell me the equivalent way to share a photo on iphone? Thanks in advance.
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+photoPath));
startActivityForResult(Intent.createChooser(share, "Share Image"), SHARE_CONSTANT);
I think the best thing to use in your case to share stuff like text, pictures etc is Sharekit.
If you want to do it on Facebook, just import the Facebook SDK in your project and implement the API.
For twitter, there is deep integration in iOS. You can simply import the Twitter framework and call the required methods. You'll be able to do something like this:
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];
[twitter addImage:[UIImage imageNamed:#"someImage.png"]];
This not the complete code. On how to add Twitter integration, check this video: http://www.youtube.com/watch?v=PtCtcx6CgOA

IOS Post Photo To Facebook Without The Facebook Connect-Api

Is it possible to post a photo to a Facebook Page wall without using the Facebook connect Api?
To post some text I tried using this:
NSString *post = [NSString stringWithFormat:#"fb://publish/profile/1111111111112311?text=%#",#"some text here"];
NSURL *url = [NSURL URLWithString:post];
thanks
To do this, I would suggest using Sharekit. ShareKit is a free api that allows you to intregrate many sharing feastures for many services, with minimal code (less than 20 lines).
Here is a link to get ShareKit: getsharekit.com
To share a photo on Facebook with Sharekit, do this:
Add sharekit to your project by coping the files found at the link above
Use the following code to set up the share instance:
UIImage *image = [UIImage imageNamed:#"someImage.jpg"];
SHKItem *item = [SHKItem image:image title:#"Look at this picture!"];
Then just share the image with this:
[SHKFacebook shareItem:item];
However, the newest Facebook API is actually pretty easy to use. And it's very well documented, so you might want to check it out. There are some benefits to using Facebook's actually API, rather then use a proxy service.

iPhone/iOS - How to use "ShareKit" to post only to Facebook or only to Twitter

In my iPhone app, I have two two buttons, labeled "Facebook" and "Twitter".
I want to use the Sharekit framework which makes my sharing very simple. But as shown in the sample code of ShareKit, I can only show many sharing services, which I don't want to include. I want my "Facebook" button to only show the Facebook sharing service, and the same with Twitter. How can I modify ShareKit to work like that?
Update:
Since this answer is still popular, I just wanted to add that with iOS 5 & iOS 6, there is much less need for Sharekit. A lot of popular sharing options are now built into the OS. That being said, this answer is still valid for the sharing services not built into the device, or if your simply more comfortable with Sharekit.
I'll show you how to do it for Facebook, Twitter is exactly the same, just change all the instances of Facebook to Twitter
First, #import "SHKFacebook.h"
then in your button's target method, put the following:
SHKItem *item; //This creates the Sharekit Item
NSURL *url = [NSURL URLWithString:#"http://itunes.apple.com/us/app/...?mt=8"];
The NSURL should be a link to your app on the app store. That way if someone sees a post your app made on Facebook, and they click it, they will be directed to the store so they can download it. Strickly speaking, this is optional, but why wouldn't you try to get new downloads with this extra one line.
Now we need to set up the SHKItem as follows:
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!"];
The title parameter is NOT user customizable. Whatever you set here the user will not be able to change. They will have the opportunity to add their own text in addition to whatever you put there.
Finally show the item:
[SHKFacebook shareItem:item];
I hope this helps. As I said, just change the Facebooks in this post to Twitter. Let me know in a comment if you need more help.
Sharekit provides a generic sharing mechanism but also exposes individual services. For instance, if you were to share a URL on twitter, you could write the following code:
#import "ShareKit/Core/SHK.h"
#import "ShareKit/Sharers/Services/Twitter/SHKTwitter.h"
...
SHKItem *item = [SHKItem URL:url title:#"A title"];
[SHKTwitter shareItem:item];
This is all explained in the documentation, but don't fear exploring the header files of the individual services.
I also had the same problem in one of my apps, and tried to force sharekit to do just that.
ShareKit isn't really made for it though, it's meant to be a provide a large range of sharing options - so even after modification, I found that it wasn't a very elegant or efficient solution.
It will save a bit of time, sure - but if you want a good looking, elegant solution I'd suggest integrating twitter and facebook yourself. It takes a bit of time, but you can define the behavior exactly as you want, and theme the interface to suit your app better.

How can I post formatted text with local image on Facebook or Twitter?

I want to share my local saved image and formatted text on Twitter or Facebook using my application.
For example, I want to combine both image and bolded text in a single post.
Are there any APIs available for it?
I recommend using ShareKit in your iOS application.
It is very easy to integrate a variety of Social Networking sites.
I find ShareKit pretty hard to use for a simple task like sharing to Facebook, Twitter or Email. Therefore I wrote a simple lib called BMSocialShare. Maybe you wanny give it a try?
BMFacebookPost *post = [[BMFacebookPost alloc]
initWithTitle:#"Simple sharing via Facebook, Email and Twitter for iOS!"
descriptionText:#"Posting to Facebook, Twitter and Email made dead simple on iOS. Simply include BMSocialShare as a framework and you are ready to go."
andHref:#"https://github.com/blockhaus/BMSocialShare"];
[post setImageUrl:#"http://www.blockhausmedien.at/images/logo-new.gif"
withHref:#"http://www.blockhaus-media.com"];
[[BMSocialShare sharedInstance] facebookPublish:post];

How to post images on facebook wall on a single button click from an iPhone app

I am making an iPhone app where in the user wants that the selected image should be posted on facebook wall on a single button click.
I have Actionsheet button for this.
I want that both authentication of user(loginButtonTapped in tutorial below) and posting images to the wall(rateTapped in tutorial below) be carried out on a single button click.
I am using the example on the link below as my reference for posting images on facebook wall
http://www.raywenderlich.com/1626/how-to-post-to-a-users-wall-upload-photos-and-add-a-like-button-from-your-iphone-app
I am a newbie.
What should I do?
How can I proceed?
Please Help and Suggest.
Thanks.
You can use the facebook Graph Api for posting images to wall..
Here is the tutorial for this...
http://www.capturetheconversation.com/technology/iphone-facebook-oauth-2-0-and-the-graph-api-a-tutorial-part-2
Before sharing you will always have to get the Facebook credentials first by either opening the Facebook App (which is called SSO / Single Sign On) or, in case the Facebook App is not installed, by opening the WebView or Safari. Posting stuff to Facebook can be pretty tricky therefore I wrote a simple lib, called BMSocialShare. It is also supporting "single click sharing". You can do things like uploading photos to Facebook easily:
BMFacebookPost *post = [[BMFacebookPost alloc] initWithImage:[UIImage imageNamed:#"image.png"]];
[[BMSocialShare sharedInstance] facebookPublish:post];
or also create a normal post:
BMFacebookPost *post = [[BMFacebookPost alloc]
initWithTitle:#"Simple sharing via Facebook, Email and Twitter for iOS!"
descriptionText:#"Posting to Facebook, Twitter and Email made dead simple on iOS. Simply include BMSocialShare as a framework and you are ready to go."
andHref:#"https://github.com/blockhaus/BMSocialShare"];
[post setImageUrl:#"http://www.blockhausmedien.at/images/logo-new.gif"
withHref:#"http://www.blockhaus-media.com"];
[[BMSocialShare sharedInstance] facebookPublish:post];
I wanted to add on my personal experience on using BMSocialShare created by vinzenzweber here, and my reputation only allows me to answer. It saved me a lot of time and from the trouble of reading Facebook's documentation, for something as simple as sharing an image for my photo app.
Just a couple of pointers on the documentation of it which might not be immediately obvious for someone using the library for the first time.
When inserting the snippet into your Info.plist containing the Facebook app id, you need to affix 'fb' in front of the number app id.
Besides adding the BMSocialShare.framework into the Xcode Project, you need to manually drag the BMSocialShare.bundle and the FBDialog.bundle in the resources folder of the BMSocialShare.framework, into the Copy Bundle Resources section under Build Phrases of your application's target