未解决

ios推错版本 #31670个回答

push_services 130*****266 2017-12-09

问:
没加DeployStatus,为何推到正式版本上,不是默认为null吗?代码如下: public static void pushMsgToAllApp(Object reqMsgJson, Integer platform, IConfigService configService) { String apiKey, secretKey; if (platform == MsgConstants.BAIDU_PLATFORM_IOS) { apiKey = configService.getConfig("baidu_ios_api_key"); secretKey = configService.getConfig("baidu_ios_secret_key"); } else { apiKey = configService.getConfig("baidu_android_api_key"); secretKey = configService.getConfig("baidu_android_secret_key"); } PushKeyPair pair = new PushKeyPair(apiKey, secretKey); // 2. build a BaidupushClient object to access released interfaces BaiduPushClient pushClient = new BaiduPushClient(pair, BaiduPushConstants.CHANNEL_REST_URL); // 3. register a YunLogHandler to get detail interacting information in this request. pushClient.setChannelLogHandler(new YunLogHandler() { @Override public void onHandle(YunLogEvent event) { LOGGER.info(event.getMessage()); } }); try { // 4. specify request arguments PushMsgToAllRequest request = new PushMsgToAllRequest() .addMsgExpires(new Integer(3600)) .addMessageType(1) .addMessage(JSON.toJSONString(reqMsgJson)) .addDeviceType(platform); LOGGER.debug("----->推送参数:"+JSON.toJSONString(request)); // 5. http request PushMsgToAllResponse response = pushClient.pushMsgToAll(request); // Http请求返回值解析 LOGGER.debug("msgId: " + response.getMsgId() + ",sendTime: " + response.getSendTime() + ",timerId: " + response.getTimerId()); } catch (PushClientException e) { if (BaiduPushConstants.ERROROPTTYPE) { throw new RuntimeException(e); } else { LOGGER.error("", e); } } catch (PushServerException e) { if (BaiduPushConstants.ERROROPTTYPE) { throw new RuntimeException(e); } else { LOGGER.info(String.format( "requestId: %d, errorCode: %d, errorMsg: %s", e.getRequestId(), e.getErrorCode(), e.getErrorMsg())); } } }
确认 取消