Note that there are some explanatory texts on larger screens.

plurals
  1. POSocial sharing url of current webview iPhone. ( Xcode)
    primarykey
    data
    text
    <p>so I have my app setup with share action button that shares the current URL to Twitter or Facebook however when I click the Facebook button it shows a Twiiter share sheet. The (Tiwtter option works fine)</p> <p>After I click the FACEBOOK option, when testing on iPhone the standard twiiter share sheet appears.</p> <pre><code>- (IBAction)social:(id)sender { UIActionSheet *share = [[UIActionSheet alloc] initWithTitle:@"Pass on the news!" delegate:self cancelButtonTitle:@"OK" destructiveButtonTitle:nil otherButtonTitles:@"Post to Twitter", @"Post to Facebook", nil]; //You must show the action sheet for the user to see it. [share showInView:self.view]; } - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { //Each button title we gave to our action sheet is given a tag starting with 0. if (actionSheet.tag == 0) { //Check Twitter accessibility and at least one account is setup. if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) { SLComposeViewController *tweetSheet =[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; [tweetSheet addURL:self.newsItemWebView.request.URL]; //This is setting the initial text for our share card. [tweetSheet setInitialText:@"Check out this article I found using the 'Pass' iPhone app:, "]; //Brings up the little share card with the test we have pre defind. [self presentViewController:tweetSheet animated:YES completion:nil]; } else { //This alreat tells the user that they can't use built in socal interegration and why they can't. UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"You can't send a tweet right now, make sure you have at least one Twitter account setup and your device is using iOS6 or above!." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } } else if (actionSheet.tag == 1) { //Check Facebook accessibility and at least one account is setup. if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *facebookSheet =[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; [facebookSheet addURL:self.newsItemWebView.request.URL]; //This is setting the initial text for our share card. [facebookSheet setInitialText:@"Check out this article I found using the 'Pass' iPhone app:"]; //Brings up the little share card with the test we have pre defind. [self presentViewController:facebookSheet animated:YES completion:nil]; } else { //This alreat tells the user that they can't use built in socal interegration and why they can't. UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"You can't post a Facebook post right now, make sure you have at least one Facebook account setup and your device is using iOS6 or above!." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload