Twitter预览表使用ActivityViewController以英文而非iOS 6上的语言设备显示

时间:2012-11-26 10:23:38

标签: ios twitter uiactivityviewcontroller

我正在使用新的ActivityViewController为用户提供在Facebook或Twitter上分享消息的可能性。我已经更改了excludedActivityTypes属性,以便仅显示ActivityViewController上的Facebook和Twitter按钮。在activityItems数组中,我只有一个带有要共享文本的NSString。

以下是代码:

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];

该设备配置为西班牙语。

所以,当我选择在Facebook上分享预览表时会出现西班牙语(正常),但是当我选择twitters时,Twitter预览表会以英文显示...这对用户来说不是很重要,但不是很漂亮。此外,它让我担心它可能是一些更重要的症状。

你知道为什么推特预览表出现在英文中吗?

UPDATE: ActivityViewIndicator的取消按钮也以英文显示

非常感谢!

卡洛斯

2 个答案:

答案 0 :(得分:4)

最后我看到问题与本地化有关。要查看任何语言的所有系统视图控制器,您必须确保已添加.lproj目录或在info.plist中添加本地化密钥以及您需要的所有语言。

目前我将西班牙语添加到info.plist中的本地化键,Twitter表格开始以西班牙语显示。

答案 1 :(得分:0)

我建议您使用新的iOS 6 API与Twitter和Facebook进行交互。它使它变得容易多了。以下是发送推文的代码

  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];
    }