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

推送相关的bug

parent 9209ab13
......@@ -24,15 +24,21 @@ extension AppDelegate: JPUSHRegisterDelegate {
// init Push
// notice: 2.1.5 版本的 SDK 新增的注册方法,改成可上报 IDFA,如果没有使用 IDFA 直接传 nil
//初始化极光推送服务,调用了本 API 后,开启 JPush 推送服务,将会开始收集上报 SDK 业务功能所必要的用户个人信息
// [JPUSHService setupWithOption:launchOptions appKey:appKey
// channel:channel
// apsForProduction:isProduction
// advertisingIdentifier:advertisingId];
// [JPUSHService setupWithOption:launchOptions appKey:appKey
// channel:channel
// apsForProduction:isProduction
// advertisingIdentifier:advertisingId];
#if DEBUG
let isProduction = false
#elseif TESTENV
let isProduction = true
#else
let isProduction = true
#endif
JPUSHService.setup(withOption:launchOptions,
appKey:"c6a9e10575b85ee90f3e8afe",
channel:"",
channel:"appStore",
apsForProduction: isProduction)
}
......@@ -42,10 +48,26 @@ extension AppDelegate: JPUSHRegisterDelegate {
print("deviceToken:\(deviceTokenStr)")
JPUSHService.registerDeviceToken(deviceToken)
YHLoginManager.shared.deviceTokenModel.deviceToken = deviceTokenStr
#if DEBUG
YHHUD.flash(message: deviceTokenStr)
#elseif TESTENV
YHHUD.flash(message: deviceTokenStr)
#else
#endif
}
//获取token 失败
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError 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