ResponsePacket theErrorResponse = pushNotification.getResponse();私は javapns2.2 を使用しており、アップルの拡張通知形式からのエラー応答パケットをキャッチしようとしています。プッシュ通知を送信すると(無効なトークンなど)、コード
Exception theProblem = pushedNotification.getException();
theProblem.printStackTrace();
コンソールにエラーを出力しますが、
ResponsePacket theErrorResponse = pushedNotification.getResponse();
if (theErrorResponse != null && theErrorResponse.isErrorResponsePacket()) {
System.out.println(theErrorResponse.getMessage());
System.out.println(theErrorResponse.getStatus());
}
常にnull を返します。getResponse() でステータス コードを取得するにはどうすればよいですか?
ここに私のコードの一部があります:
List<PushedNotification> notifications = Push.payload(payload, keystore, password, production, devices);
for (PushedNotification pushedNotification : notifications) {
if(pushedNotification.isSuccessful())
{
System.out.println(pushedNotification.getDevice().getToken());
}
else
{
System.out.println(pushedNotification.getDevice().getToken());
Exception theProblem = pushedNotification.getException();
theProblem.printStackTrace();
ResponsePacket theErrorResponse = pushedNotification.getResponse();
if (theErrorResponse != null && theErrorResponse.isErrorResponsePacket()) {
System.out.println(theErrorResponse.getMessage());
System.out.println(theErrorResponse.getStatus());
}
}
}
ご協力ありがとうございました