Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javapns提供InvalidDeviceTokenFormatException_Java_Ios_Push Notification_Apple Push Notifications - Fatal编程技术网

Javapns提供InvalidDeviceTokenFormatException

Javapns提供InvalidDeviceTokenFormatException,java,ios,push-notification,apple-push-notifications,Java,Ios,Push Notification,Apple Push Notifications,我正在使用JavaPNS发送通知。但是,我得到了以下错误: javapns.devices.exceptions.InvalidDeviceTokenFormatException: Device Token has a length of [140] and not the required 64 bytes!eror has occusred:Device Token has a length of [140] and not the required 64 bytes!

我正在使用JavaPNS发送通知。但是,我得到了以下错误:

javapns.devices.exceptions.InvalidDeviceTokenFormatException: Device Token has a length of [140] and not the required 64 bytes!eror has occusred:Device Token has a length of [140] and not the required 64 bytes!

        at javapns.devices.implementations.basic.BasicDevice.validateTokenFormat(BasicDevice.java:67)
        at javapns.devices.implementations.basic.BasicDevice.<init>(BasicDevice.java:49)
        at javapns.devices.implementations.basic.BasicDevice.<init>(BasicDevice.java:37)
javapns.devices.exceptions.InvalidDeviceTokenInformation异常:设备令牌的长度为[140],而不是所需的64字节!eror已发生RED:设备令牌的长度为[140],而不是所需的64字节!
位于javapns.devices.implementations.basic.BasicDevice.validateTokenFormat(BasicDevice.java:67)
位于javapns.devices.implements.basic.BasicDevice。(BasicDevice.java:49)
位于javapns.devices.implementations.basic.BasicDevice。(BasicDevice.java:37)
以下是我创建设备列表的方式:

List<Device> newList = new ArrayList<Device>();
            Iterator<String> tempItr = v.iterator();
            while (tempItr.hasNext()) {
                String myDeviceToken = (String) (vItr.next());
                try {
                    BasicDevice device = new BasicDevice(myDeviceToken);

                    newList.add(device);

                } catch (Exception e) { // error=2; // notification issue
                    System.out.println("eror has occusred:" + e.getMessage());
                    e.printStackTrace();

                }
            }
List newList=newarraylist();
迭代器tempItr=v.Iterator();
while(tempItr.hasNext()){
字符串myDeviceToken=(字符串)(vItr.next());
试一试{
基本设备=新的基本设备(myDeviceToken);
添加(设备);
}捕获(异常e){//error=2;//通知问题
System.out.println(“eror已发生:”+e.getMessage());
e、 printStackTrace();
}
}
给出无效令牌格式的任何线索:

这是错误的:

String myDeviceToken = (String) (vItr.next());
应该是:

String myDeviceToken = vItr.next().getToken();
编辑:我假设v是
列表
,但您没有指定v的类型。

这是错误的:

String myDeviceToken = (String) (vItr.next());
应该是:

String myDeviceToken = vItr.next().getToken();
编辑:我假设v是
List
,但您没有指定v的类型