gpt4 book ai didi

java - 100% CPU 在 javapns 中使用

转载 作者:行者123 更新时间:2023-11-28 17:43:10 26 4
gpt4 key购买 nike

我正在为一个项目工作,向 iPhone 发送通知。我使用了 javapns。但是当我调用消息时:

pushManager.sendNotification(client, complexPayLoad);

我发现消息无法正确返回,导致 cpu 使用率变为 100%。谁能告诉我我的代码哪里出了问题?谢谢。

更多补全代码

try {
// create a complex PayLoad with a custom alert
PayLoad complexPayLoad = new PayLoad();
PayLoadCustomAlert customAlert = new PayLoadCustomAlert();
customAlert.addBody(message);
complexPayLoad.addCustomAlert(customAlert);
complexPayLoad.addSound("chime");
for (String key : new HashSet<String>(data.keySet())) {
complexPayLoad.addCustomDictionary(key, (String)data.get(key));
}

try {
// Link iPhone's UDID (64-char device token) to a stringName
pushManager.addDevice(token, token);
} catch (Exception ex) {
// Perhaps we added duplicate devices
log.debug("Perhaps we added duplicate devices");
}

// Get iPhone client
Device client = pushManager.getDevice(token);

// Send message
pushManager.sendNotification(client, complexPayLoad);
log.info("Message sent!"); // i cannot get this message

} catch (Exception e) {
log.error(e.getMessage());
}

最佳答案

什么版本?

第 2 版刚刚发布,修复了一些问题。

它也更容易实现。

关于java - 100% CPU 在 javapns 中使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7314432/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com