ShareKit iOS - different content for different platforms

断了今生、忘了曾经 提交于 2019-12-07 02:07:27

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!