Twitter preview sheet appears in English instead of language device on iOS 6 using ActivityViewController

StackOverflow https://stackoverflow.com/questions/13562814

Pregunta

I'm using the new ActivityViewController to give the user the possibility to share a message in Facebook or Twitter. I've changed the excludedActivityTypes property in order to show only the Facebook and Twitter buttons on the ActivityViewController. In the activityItems array I have only a NSString with the text to share.

Here is the code:

NSString *text = @"Text to share";

NSArray *activityItems = [NSArray arrayWithObjects:text, nil];

UIActivityViewController *avc = [[UIActivityViewController alloc] initWithActivityItems: activityItems applicationActivities:nil];

// Indicamos los servicios estándar que no queremos mostrar
NSArray *excludedActivityTypes = [NSArray arrayWithObjects:UIActivityTypePostToWeibo,  UIActivityTypeMessage, UIActivityTypeMail, UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, nil];

avc.excludedActivityTypes = excludedActivityTypes;

[self presentViewController:avc animated:YES completion:nil];

The device is configured in Spanish.

So, when I choose share in Facebook the preview sheet appears in Spanish (normal), but when I choose twitters the twitter preview sheet appears in English... It's not very important, but not very pretty for the user. Also, it worries me that it can be a symptom of something more important.

Do you know why is the twitter preview sheet appearing in English??

UPDATE: The cancel button of the ActivityViewIndicator is also appearing in English

Thanks a lot!

Carlos

¿Fue útil?

Solución

Finally I saw the problem was related the localizations. In order to see all the system viewcontrollers in any language you must ensure you have added either an .lproj directory or add in the info.plist the localizations key with all the languages you need.

At the moment I added spanish to localizations key in the info.plist the twitter sheet began to appear in spanish.

Otros consejos

I recommend you use the new iOS 6 API to interact with Twitter and Facebook. It makes it a lot easier. Here is the code to send a Tweet

  if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];

        tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) {
            switch(result)
            {

                case SLComposeViewControllerResultCancelled:
                    break;
                   //  This means the user hit 'Cancel'
                case SLComposeViewControllerResultDone:
                     //  This means the user hit 'Send'

                    break;
            }

            //  dismiss the Tweet Sheet
            dispatch_async(dispatch_get_main_queue(), ^{
                [self dismissViewControllerAnimated:NO completion:^{

                    NSLog(@"Tweet Sheet has been dismissed.");

                }];
            });
        };


        [tweetSheet setInitialText:@"Tweeting from my own app! :)"];

        [self presentViewController:tweetSheet animated:YES completion:NULL];
    }
    else
    {
        UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"Sorry"
                                  message:@"You can't send a tweet right now, make sure\
                                  your device has an internet connection and you have\
                                  at least one Twitter account setup"
                                  delegate:self
                                  cancelButtonTitle:@"OK"
                                  otherButtonTitles:nil];
        [alertView show];
    }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top