Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 11    Views: 135

feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
01/16/13 12:22 PM (13 years ago)

Sharekit integration

Hello I saw 2 posts about integrating sharekit and no one responded. I just integrated socialize and would like to experiment with sharekit to see the differences. It looks like the last step of integrating share kit is out of my league can any one help. Here is the last step- I dont know where this goes Step 4: Calling ShareKit Import the ShareKit Header In any class where you call ShareKit, you'll need to include the ShareKit header at the top. At the top of your class you'll probably see other imports already. Add ShareKit to list like: #import "SHK.h" Add a Share Button This section is subjective and entirely depends on how you design your app. It assumes you know how to create a button that performs an action. If you'd like more guidance, take a look a the example project (included in the ShareKit download). It has a separate example for sharing links, images, text, and files. You need to add a way to allow the user to say 'hey, I want to share this!'. It is up to you where to place this button and even what it looks like. If your app has a UIToolbar or UINavigationBar, a common practice is adding a UIBarButtonItem with the UIBarButtonSystemItemAction system item style. This icon has become the standard for sharing amongst iOS apps. An example may look like: [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(share)] Handling the Button Action After you've added a button and set a target action to call when it's pushed, it's finally time to call ShareKit. A user's entry point into ShareKit is an actionsheet. This actionsheet displays the user's most used services and a more button for additional options. The actionsheet will only display services that can respond to the item you want to share. So the first step is to create an object (SHKItem) that describes what you want to share (a url, image, text, or file). With that item, you create an actionsheet and display it to the user. Here are the 3 steps together. In this example we'll share a URL: - (void)myButtonHandlerAction { // Create the item to share (in this example, a url) NSURL *url = [NSURL URLWithString:@"http://getsharekit.com"]; SHKItem *item = [SHKItem URL:url title:@"ShareKit is Awesome!"]; // Get the ShareKit action sheet SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; // Display the action sheet [actionSheet showFromToolbar:navigationController.toolbar]; } That's it! ShareKit will take over from there and handle everything else. This includes logging the user in to their selected service, allowing them to edit the share item, displaying activity indicators, and even sharing offline. Note: How/Where you display the action sheet is up to you. On an iPad you may want to display this as a popover from your share button. For all possible options, take a look at the UIActionSheet documentation. To see examples sharing other types of content (images, text, or files) check out the complete documentation or example project included in the ShareKit download.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
01/16/13 12:56 PM (13 years ago)
You have done the hard part You need to add the is code to each and every plugin you want the share to be in. add this #import "SHK.h" where all of the other imports are. You then need to create your button whether this be in interface builder, or add to toolbars or nav bars, floating buttons. It depends what page. These will all have a selector() part of the button setup Then this method does all the work note the selector(share ) matches the method - (void)share { // Create the item to share (in this example, a url) NSURL *url = [NSURL URLWithString:@"http://getsharekit.com"]; SHKItem *item = [SHKItem URL:url title:@"ShareKit is Awesome!"]; // Get the ShareKit action sheet SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; // Display the action sheet [actionSheet showFromToolbar:navigationController.toolbar]; }
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
01/16/13 03:02 PM (13 years ago)
Thanks for the earlier share of free software ! Ok so how do i create a button to a circle menu or add to toolbars or nav bars or floating buttons? Then where does the method go?
 
Moto110
Aspiring developer
Profile
Posts: 205
Reg: Jul 26, 2011
Orlando, FL
8,700
like
01/17/13 09:39 AM (13 years ago)
@feraco - Once you get ShareKit working in an app I would be interested in hearing what you think of it.
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
01/17/13 10:21 AM (13 years ago)
I will but right now im stuck. If I build before creating the button or add to toolbars or nav bars or floating buttons I get build fall because of use of undeclared identifier 'navigationController' I dont know how.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
01/17/13 10:27 AM (13 years ago)
That's because you haven't got a toolbar set up use this instead [actionSheet showInView:self.viewController.view]
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
01/17/13 10:44 AM (13 years ago)
thanks for the response ! Now it says build fail because property viewController not found on object type
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
01/17/13 11:00 AM (13 years ago)
Sent you a PM
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
01/17/13 11:10 AM (13 years ago)
thanks for the response ! Now it says build fail because property viewController not found on object type
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
01/17/13 12:06 PM (13 years ago)
try this [actionSheet showInView:self.view] forgot we don't use a view controller like that in buzztouch
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
01/17/13 12:25 PM (13 years ago)
I will but right now im stuck. If I build before creating the button or add to toolbars or nav bars or floating buttons I get build fall because of use of undeclared identifier 'navigationController' I dont know how.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
01/17/13 12:31 PM (13 years ago)
try, in all the code you've written remove navigationController. e.g [self.navigationcontroller.view} change to [self.view] I can't really help unless I see the code, the offer is there
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.