Javapns提供InvalidDeviceTokenFormatException
我正在使用JavaPNS发送通知。但是,我得到了以下错误: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.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的类型