极光推送可以后请求权限吗?


(翎小伊) #1

现在的需求是不是在app打开的时候请求是否推送,而是在用户进行某一步操作的时候进行推送
具体执行代码是:

let settings = UIApplication.shared.currentUserNotificationSettings
        if settings?.types.rawValue == 0 {
            let entity = JPUSHRegisterEntity.init()
            entity.types = Int(JPAuthorizationOptions.alert.rawValue | JPAuthorizationOptions.badge.rawValue | JPAuthorizationOptions.sound.rawValue)
            
            JPUSHService.register(forRemoteNotificationConfig: entity, delegate: AppDelegate.self as! JPUSHRegisterDelegate)
            
        }

这样执行的结果是 能在某阶段再执行推送请求,可是执行不到appdelegate里面的
didRegisterForRemoteNotificationsWithDeviceToken 和
didFailToRegisterForRemoteNotificationsWithError
如何破?


(翎小伊) #2

而且极光报错:

| JIGUANG | W - [JIGUANGClientController] Not get deviceToken yet. Maybe: your certificate not configured APNs? or current network is not so good so APNs registration failed? or there is no APNs register code? Please refer to JPush docs.


#3

报错的解决:

关于延后注册