gpt4 book ai didi

java - 为什么我无法在 ColdFusion 8 中调用 java-apns getInactiveDevices() 方法?

转载 作者:行者123 更新时间:2023-12-01 12:31:06 27 4
gpt4 key购买 nike

我正在构建一个应用程序,使用 notnoop 的 java-apns 库从 ColdFusion 8 向 Apple 设备发送推送通知,当调用库中的方法时,我收到“找不到方法”异常,即使该方法是 clearly defined in the library (第 161 行)。我能够成功发送推送通知,只是这一种方法不起作用。这里可能出了什么问题???

代码:

<cfscript>
LOCAL.APNSService =
CreateObject("java", "com.notnoop.apns.APNS").newService()
.withCert(
"MyCert.p12",
"MyPassword"
)
.withProductionDestination()
.build();

LOCAL.APNSService.start();
LOCAL.InactiveDevices = LOCAL.APNSService.getInactiveDevices();

LOCAL.payload =
CreateObject("java", "com.notnoop.apns.APNS").newPayload()
.badge(1)
.alertBody("Hello, world.")
.sound("PushNotification.caf")
.build();

LOCAL.APNSNotification =
CreateObject("java", "com.notnoop.apns.SimpleApnsNotification")
.init(
JavaCast("string", LOCAL.MyDeviceToken),
JavaCast("string", LOCAL.payload)
);
LOCAL.APNSService.push(LOCAL.APNSNotification);

LOCAL.APNSService.stop();
</cfscript>

异常(exception):

The getInactiveDevices method was not found.

堆栈跟踪:

coldfusion.runtime.java.MethodSelectionException: The getInactiveDevices method was not found.
at coldfusion.runtime.java.ObjectHandler.findMethodUsingCFMLRules(ObjectHandler.java:322)
at coldfusion.runtime.StructBean.invoke(StructBean.java:527)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2300)

最佳答案

Benn Linger 创建了此解决方法:http://www.bennlinger.com/uploads/get_inactive_devices.txt

关于java - 为什么我无法在 ColdFusion 8 中调用 java-apns getInactiveDevices() 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25914987/

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