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

时间:2014-09-18 14:08:07

标签: java coldfusion apple-push-notifications coldfusion-8 javapns

我正在构建一个应用程序,使用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>

例外:

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)

1 个答案:

答案 0 :(得分:1)

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