0

我正在构建一个应用程序,以使用 notnoop 的 java-apns 库从 ColdFusion 8 向 Apple 设备发送推送通知,并且在调用库中的方法时,我收到“未找到方法”异常,即使该方法已明确定义在图书馆(第 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>

例外:

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)
4

1 回答 1

1

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

于 2014-09-30T16:12:17.350 回答