求大神给小弟我看一下ios推送的有关问题
求大神给我看一下ios推送的问题
代码
错误信息
不知道是啥原因求大神
------解决方案--------------------
你参数传的不对。给你个链接自己看看。
代码
package com.vo;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.stereotype.Service;
import com.entity.ReturnStatusChinese;
import com.util.BeanUtil;
import com.util.StringUtil;
import javapns.back.PushNotificationManager;
import javapns.back.SSLConnectionHelper;
import javapns.data.Device;
import javapns.data.PayLoad;
@Service
@RemotingDestination(channels = { "my-amf" })
public class IosPush {
public static void main(String[] args) throws Exception {
try {
String deviceToken = "7be3700ab49f705d182548cb0d6d3ae880dd4de82bc30aaebe2a4148680b0f28";//iphone手机获取的token
PayLoad payLoad = new PayLoad();
payLoad.addAlert("我的push测试");//push的内容
payLoad.addBadge(1);//图标小红圈的数值
payLoad.addSound("default");//铃音
PushNotificationManager pushManager = PushNotificationManager.getInstance();
pushManager.addDevice("iPhone", deviceToken);
//Connect to APNs
/************************************************
测试的服务器地址:gateway.sandbox.push.apple.com /端口2195
产品推送服务器地址:gateway.push.apple.com / 2195
***************************************************/
String host= "gateway.sandbox.push.apple.com";
int port = 2195;
String certificatePath= "/Users/jcjc/Desktop/push_p.p12";//导出的证书
String certificatePassword= "sunlg";//此处注意导出的证书密码不能为空因为空密码会报错
pushManager.initializeConnection(host,port, certificatePath,certificatePassword, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
//Send Push
Device client = pushManager.getDevice("iPhone");
pushManager.sendNotification(client, payLoad);
pushManager.stopConnection();
pushManager.removeDevice("iPhone");
}
catch (Exception e) {
e.printStackTrace();
}
}
}
错误信息
java.lang.RuntimeException: Stub!
at org.json.JSONObject.<init>(JSONObject.java:4)
at javapns.data.PayLoad.<init>(Unknown Source)
at com.vo.IosPush.main(IosPush.java:22)
不知道是啥原因求大神
------解决方案--------------------
你参数传的不对。给你个链接自己看看。