Created
November 28, 2013 08:43
-
-
Save avwave/7688905 to your computer and use it in GitHub Desktop.
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:SLServiceTypeTwitter]) { | |
SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; | |
[tweetSheet addImage:image]; | |
[tweetSheet setInitialText:[NSString stringWithFormat:@"%@ %@", kSHARETEXT, self.filterName]]; | |
tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) { | |
switch (result) { | |
case SLComposeViewControllerResultCancelled: | |
[Flurry logEvent:@"Share to twitter - cancelled"]; | |
break; | |
case SLComposeViewControllerResultDone: | |
[Flurry logEvent:@"Share to twitter - success"]; | |
break; | |
default: | |
break; | |
} | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[vc dismissViewControllerAnimated:YES completion:^{ | |
}]; | |
}); | |
}; | |
[vc presentViewController:tweetSheet animated:YES completion:^{ | |
}]; | |
} else { | |
[[[UIAlertView alloc] initWithTitle:@"Sign in with Twitter" | |
message:@"Sign in with Twitter on your device" | |
delegate:nil | |
cancelButtonTitle:@"OK" | |
otherButtonTitles:nil, nil] show]; | |
[Flurry logEvent:@"Share to twitter - no twitter detected alert"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment