推送ios没有title参数,将title和body放到alert里面,推送过去之后是字符串,这个 怎么解决

ysy13613312332
2017-07-20 02:12 1k 0
public static void pushByAlias(String title,String message,List<String> alias){
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("title", title);
    map.put("body", message);
    JSONObject jsonObject = JSONObject.fromObject(map);
    System.out.println("++++++++++++++++++++++++++++++"+jsonObject);
    PushPayload payload =PushPayload.newBuilder()
                                    .setPlatform(Platform.android_ios())
                                    .setAudience(Audience.alias(alias))
                                    .setMessage(Message.newBuilder()
                                    .setMsgContent(message)
                                    .addExtra("from", "JPush").build())
                                    .setNotification(Notification.newBuilder()
                                    .addPlatformNotification(IosNotification.newBuilder()
                                            .setAlert(jsonObject)
                                            .build())
                                    .addPlatformNotification(AndroidNotification.newBuilder()
                                            .setTitle(title)
                                            .setAlert(message)
                                            .build())
                                    .build())  
                                    .build(); 
    sendPush(payload);
}

推送给ios后,ios接收到的是字符串,不是json,怎么解决

1个回答

热门排序