4

我有一个严重的问题,我在网上没有找到任何问题。当我推送本地化消息时,它仅适用于瑞典语而不适用于英语。我还有一个说它只显示他们的瑞典 Iphone 4 的常数。我也在 Iphone 3g 上进行了测试,它和我的 iphone 4 有同样的问题,用瑞典语而不是英语工作。

当用英语显示 Iphone 4 的弹出窗口时,我只能从服务器获得我在通知中提供的本地化密钥。

这是我从 Windows Server 推送的 C# 通知字符串。我的 iphone 应用程序的额外参数在任何语言中都可以正常工作,因此它似乎与推送的服务器端部分无关。

int total = notification.AmountScheduledEvent + notification.AmountCourseResult + notification.AmountExam;
string locKey = (total > 1 ? "PushMessageMultiple" : "PushMessageSingle");
string msg = "{\"aps\":{"+
                  "\"alert\": {"+
                      "\"loc-key\":\"" + locKey + "\","+
                      "\"loc-args\":[\"" + total + "\"]},"+
                  "\"badge\":" + total + ","+
                  "\"sound\":\"default\"},"+
              "\"amountSchedule\":" + notification.AmountScheduledEvent + ","+
              "\"amountCourseResult\":" + notification.AmountCourseResult + ","+
              "\"amountExam\":" + notification.AmountExam + "}";

在我的 sv.lproj 中的 Localizable.strings 中:

/* push stuff */
"PushMessageMultiple" = "%@ nya händelser";
"PushMessageSingle" = "1 ny händelse";

在我的 en.lproj 中的 Localizable.strings 中:

/* push stuff */
"PushMessageMultiple" = "%@ new events";
"PushMessageSingle" = "1 new event";

这是带有有效通知的屏幕图片(瑞典语) http://img267.imageshack.us/i/img0014b.png/

这是屏幕上的图片,通知不起作用(英文) http://img696.imageshack.us/i/img0015i.png/

知道为什么我得到一个常量而不是消息吗?

4

1 回答 1

0

尝试使用:

NSLocalizedString(@"PushMessageMultiple",@"");

这将动态地获得正确的字符串。

于 2011-02-20T18:13:55.483 回答