Reputation: 18629
I am working from this example of setting up ShareKit: http://getsharekit.com/install/
and their example has this:
- (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];
}
But the last line there gives me a syntax error:
Use of undeclared identifier 'navigationController'
Also, my function is defined like this because I was looking to invoke the Sharing library after the user pressed the share button:
- (IBAction)share:(id)sender
Would anyone know why I am getting this error and what would be the right way to invoke the share functionality in my case?
Thanks!
Upvotes: 1
Views: 796
Reputation: 443
Without seeing your entire code, it sounds like you don't have a UINavigationController, just a UIViewController. If that's the case, this should do the trick.
In you .h file
@property (nonatomic, strong) IBOutlet UIWindow *window;
@property (nonatomic, strong) UINavigationController *NVC;
In your .m file
UIViewController *theViewController = [[TheViewController alloc]initWithNibName:@"TheViewController" bundle:nil];
self.NVC = [[UINavigationController alloc] initWithRootViewController:theViewController];
[[self window] setRootViewController:NVC];
[self.window makeKeyAndVisible];
Upvotes: 1