Commit 92d9087e authored by David黄金龙's avatar David黄金龙

推送相关的bug

parent 9209ab13
...@@ -24,15 +24,21 @@ extension AppDelegate: JPUSHRegisterDelegate { ...@@ -24,15 +24,21 @@ extension AppDelegate: JPUSHRegisterDelegate {
// init Push // init Push
// notice: 2.1.5 版本的 SDK 新增的注册方法,改成可上报 IDFA,如果没有使用 IDFA 直接传 nil // notice: 2.1.5 版本的 SDK 新增的注册方法,改成可上报 IDFA,如果没有使用 IDFA 直接传 nil
//初始化极光推送服务,调用了本 API 后,开启 JPush 推送服务,将会开始收集上报 SDK 业务功能所必要的用户个人信息 //初始化极光推送服务,调用了本 API 后,开启 JPush 推送服务,将会开始收集上报 SDK 业务功能所必要的用户个人信息
// [JPUSHService setupWithOption:launchOptions appKey:appKey // [JPUSHService setupWithOption:launchOptions appKey:appKey
// channel:channel // channel:channel
// apsForProduction:isProduction // apsForProduction:isProduction
// advertisingIdentifier:advertisingId]; // advertisingIdentifier:advertisingId];
#if DEBUG
let isProduction = false let isProduction = false
#elseif TESTENV
let isProduction = true
#else
let isProduction = true
#endif
JPUSHService.setup(withOption:launchOptions, JPUSHService.setup(withOption:launchOptions,
appKey:"c6a9e10575b85ee90f3e8afe", appKey:"c6a9e10575b85ee90f3e8afe",
channel:"", channel:"appStore",
apsForProduction: isProduction) apsForProduction: isProduction)
} }
...@@ -42,10 +48,26 @@ extension AppDelegate: JPUSHRegisterDelegate { ...@@ -42,10 +48,26 @@ extension AppDelegate: JPUSHRegisterDelegate {
print("deviceToken:\(deviceTokenStr)") print("deviceToken:\(deviceTokenStr)")
JPUSHService.registerDeviceToken(deviceToken) JPUSHService.registerDeviceToken(deviceToken)
YHLoginManager.shared.deviceTokenModel.deviceToken = deviceTokenStr YHLoginManager.shared.deviceTokenModel.deviceToken = deviceTokenStr
#if DEBUG
YHHUD.flash(message: deviceTokenStr)
#elseif TESTENV
YHHUD.flash(message: deviceTokenStr)
#else
#endif
} }
//获取token 失败 //获取token 失败
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { //可选 func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { //可选
print("did Fail To Register For Remote Notifications With Error: \(error)") print("did Fail To Register For Remote Notifications With Error: \(error)")
#if DEBUG
YHHUD.flash(message: error.localizedDescription)
#elseif TESTENV
YHHUD.flash(message: error.localizedDescription)
#else
#endif
} }
//点推送进来执行这个方法 //点推送进来执行这个方法
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment