I am trying to use ShareKit to share via email an HTML string and share on Facebook a regular stream containing an image and some text.
The sample project just shows how to share the same info for every platform(Twitter, Facebook, email) but I want to be able to share different content according to the platform.
SHKItem *item = [SHKItem image:image title: @"title"];
item.text = @"share text";
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
any ideas?
I was looking for something similar and found it in ShareKit's documentation: http://www.getsharekit.com/docs/
What you are looking for (I believe) is sharing to a specific service provider, and not using that action sheet interface. That's what I've done to create different content for different platforms.
Code:
#import "SHKFacebook.h"
#import "SHKTwitter.h"
...
- (IBAction)shareOnFacebook {
// Create an image item
SHKItem *item = [SHKItem image:[UIImage imageNamed:@"myImage.png"] title:@"A Girraffe!"];
// Share the item on Facebook
[SHKFacebook shareItem:item];
return;
}
- (IBAction)shareOnTwitter {
// Create a text item
NSString *someText = @"This is a blurb of text I highlighted from a document.";
SHKItem *item = [SHKItem text:someText];
// Share the item on Twitter
[SHKTwitter shareItem:item];
return;
}
Hope this helps! Oded.
My own experience: I succeeded in only sharing URLs on Twitter while sharing both URLs and images on Facebook.
What I did: I rewrote some of SHKItem's instance methods, such as:
//original
SHKItem *item = [SHKItem image:image title: @"title"];
//new version
SHKItem *item = [SHKItem image:image url:aURL title: @"title"];
and other related methods. In this way whenever I created a SHKItem instance, I would be able to pass both URLs and images to the following classes that are going to handle the sharing issues.
来源:https://stackoverflow.com/questions/4617448/sharekit-ios-different-content-for-different-platforms