繁体   English   中英

推送通知显示本地化常量而不是消息

[英]Push Notification showing localization constant instead of message

我有一个严重的问题,我没有在网上发现任何问题。 当我推送本地化的消息时,它只适用于瑞典语,而不适用于英语。 我还有另外一个说它只显示了他们的瑞典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/

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

尝试使用:

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM