Parse platform 如何本地化解析推送通知?

Parse platform 如何本地化解析推送通知?,parse-platform,localization,push-notification,apple-push-notifications,Parse Platform,Localization,Push Notification,Apple Push Notifications,看起来苹果已经有了内置的功能,通过在aps负载中包含loc键来本地化推送通知。然而,我不相信Parse的iOS SDK允许您自己使用sendPushInBackground设置该密钥。有没有办法不用先路由到我自己的服务器就使用Parse来本地化push?与PFPush一起使用的数据字典中的警报键可以设置为字典而不是字符串 对于将来发现这个的人来说,我的是这样的: NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:

看起来苹果已经有了内置的功能,通过在aps负载中包含loc键来本地化推送通知。然而,我不相信Parse的iOS SDK允许您自己使用sendPushInBackground设置该密钥。有没有办法不用先路由到我自己的服务器就使用Parse来本地化push?

与PFPush一起使用的数据字典中的警报键可以设置为字典而不是字符串

对于将来发现这个的人来说,我的是这样的:

NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
                      @{@"loc-key":@"NEW_MESSAGE_PUSH", @"loc-args":@[sender.name]}, @"alert",
                      @"default", @"sound",
                      @"Increment", @"badge",
                      sender.pid, @"senderID",
                      nil];
然后在Localizable.strings(Base)中添加:

在Localizable.strings(法语)中添加:

请注意,在您的用户授权应用程序后,您应该将当前用户对象添加到安装中,以便我们可以查询他(如上所示):

PFQuery *pushQuery = [PFInstallation query];
[pushQuery whereKey:@"user" equalTo:author];
NSString *key = @"PUSH_LOC_KEY_SEND_TO_AUTHOR";
NSArray *args = @[name] 
 NSDictionary *data = @{
                        @"alert": @{@"loc-key": key,
                                       @"loc-args": args},
                           @"badge": @"Increment",
                           @"sound": @"default"
                           };
PFPush *push = [[PFPush alloc] init];
[push setQuery:pushQuery];
[push setData:data];
"PUSH_LOC_KEY_SEND_TO_AUTHOR" = "%@ sent you a message";
"PUSH_LOC_KEY_SEND_TO_AUTHOR" = "%@ vous envoyé un message";
PFInstallation *installation = [PFInstallation currentInstallation];
installation[@"user"] = [PFUser currentUser];
[installation saveEventually];