0

我正在使用新的 ActivityViewController 让用户可以在 Facebook 或 Twitter 上分享消息。我更改了 excludeActivityTypes 属性,以便在 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 中选择分享时,预览表显示为西班牙语(正常),但当我选择推特时,推特预览表显示为英文......这不是很重要,但对用户来说不是很漂亮。此外,我担心它可能是更重要的事情的征兆。

你知道为什么推特预览表是英文的吗??

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

非常感谢!

卡洛斯

4

2 回答 2

4

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

目前,我在 info.plist 中的本地化键中添加了西班牙语,推特表开始以西班牙语出现。

于 2012-11-30T08:54:37.027 回答
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];
    }
于 2012-11-26T11:29:08.380 回答