Created
April 29, 2014 16:30
-
-
Save alansparrow/11405425 to your computer and use it in GitHub Desktop.
iOS facebook share
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) | |
{ | |
SLComposeViewController *facebookSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; | |
[facebookSheet setInitialText:@"Facebooking from my own app: http://www.google.com! :)"]; | |
NSString *gameURL = @"http://www.google.com"; | |
[facebookSheet addURL:[NSURL URLWithString:gameURL]]; | |
[[CCDirector sharedDirector] presentViewController:facebookSheet animated:NO completion:nil]; | |
NSLog(@"Twitter1"); | |
} | |
else | |
{ | |
UIAlertView *alertView = [[UIAlertView alloc] | |
initWithTitle:@"Sorry" | |
message:@"You can't share right now, make sure your device has an internet connection and you have at least one Facebook account setup" | |
delegate:self | |
cancelButtonTitle:@"OK" | |
otherButtonTitles:nil]; | |
[alertView show]; | |
NSLog(@"Twitter2"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment