SmartPush, 一款IOS苹果推送测试程序, Mac OS下的apns工具APP
- 拖拽或者浏览测试证书和生产证书到指定输入框
- 本机必须装有证书对应的私钥!!!!
- 填写对应的device token (device token 不同环境不同)
- 获取device token
// Receive deviceToken - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { NSString *deviceTokenString = [deviceToken description]; deviceTokenString = [deviceTokenStr stringByReplacingOccurrencesOfString:@" " withString:@""]; deviceTokenString = [deviceTokenStr stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]]; // deviceTokenString 就是我们要的, 比如:ff18c50062eaa7e7787fa466295ea7bd1b301c5ad3ea6552b4fee36dd0b056d6 }
- 填写Payload
- apns模版
{ "aps": { "alert":"This is some fancy message.", "badge":1, "sound": "default" } }
- 当前咱们~
{ "aps": { "alert": { "title":"消息标题", "body":"消息内容" }, "badge":1, "sound": "default" }, "ext": { "pushtime":"", "url":"http:://打开页面的url" }, }
- 选择推送环境【测试环境、生产环境】
- 连接推送服务器
- 发送推送
- 手机接收推送消息
- 可能会遇到的问题: