接收不到自定义消息 apns可以

jpush
ios
收不到消息
标签: #<Tag:0x00007fb84cd1a608> #<Tag:0x00007fb84cd1a4c8> #<Tag:0x00007fb84cd1a388>

(孤独终老) #1
2018-08-02 14:12:26.987509+0800 Doctor[13290:6375024]  | JIGUANG | I - [JIGUANGService] 
--------------------------- JPush Log ----------------------------
--------------------JPush SDK Version:3.1.0--build:64----------
--------------------JCore Lib Version:1.2.1--build:53----------
-----------------AppKey:970bd98d687c3a3f26ae818b----------------
----------------------------------------------------------------
2018-08-02 14:12:26.995822+0800 Doctor[13290:6375024]  | JIGUANG | I - [JIGUANGClientController] Action - jpush setup
2018-08-02 14:12:26.997054+0800 Doctor[13290:6375024]  | JIGUANG | I - [JIGUANGClientController] Action - setup
2018-08-02 14:12:27.174546+0800 Doctor[13290:6375049] Missing server connection for kCTConnectionInvalidatedNotification
1
JIGUANG | I - [JIGUANGSessionController] connecting with coreAddr 117.121.49.102,port 7000
2018-08-02 14:12:27.725315+0800 Doctor[13290:6375026]  | JIGUANG | I - [JIGUANGLogin] 
----- login result -----
uid:18550856300 
registrationID:141fe1da9efc74c1329 
idc:1
2018-08-02 14:12:37.178105+0800 Doctor[13290:6375026] [BoringSSL] Function boringssl_session_errorlog: line 2881 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert
2018-08-02 14:12:37.178193+0800 Doctor[13290:6375026] [BoringSSL] Function boringssl_session_errorlog: line 2881 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert

#2

ios 自定义消息前台接受不展示


(孤独终老) #3

是收不到jpfNetworkDidReceiveMessage消息

    let entity = JPUSHRegisterEntity()
        entity.types = Int(UInt8(JPAuthorizationOptions.badge.rawValue) | UInt8(JPAuthorizationOptions.sound.rawValue))
        JPUSHService.register(forRemoteNotificationConfig: entity, delegate: self)
        JPUSHService.setup(withOption: launchOptions, appKey: "970bd98d687c3a3f26ae818b", channel: "App Store", apsForProduction: false)
        JPUSHService.registrationIDCompletionHandler { (resCode, ID) in
            UserDefaults.standard.set(ID, forKey: "registrationID")
            NotificationCenter.default.addObserver(self, selector: #selector(self.JPushDidReciveData(notification:)), name:NSNotification.Name.jpfNetworkDidReceiveMessage, object: nil)
        }

   // MARK: -JPUSHRegisterDelegate
    func jpushNotificationCenter(_ center: UNUserNotificationCenter!, willPresent notification: UNNotification!, withCompletionHandler completionHandler: ((Int) -> Void)!) {
        let userinfo = notification.request.content.userInfo
        print(userinfo)
        JPUSHService.handleRemoteNotification(userinfo)
        if UIApplication.shared.applicationState == .background {
            completionHandler(Int(UNNotificationPresentationOptions.badge.rawValue |
                UNNotificationPresentationOptions.sound.rawValue))
        }else{
            completionHandler(Int(UNNotificationPresentationOptions.sound.rawValue))
        }
    }
    
    func jpushNotificationCenter(_ center: UNUserNotificationCenter!, didReceive response: UNNotificationResponse!, withCompletionHandler completionHandler: (() -> Void)!) {
        let userinfo = response.notification.request.content.userInfo
        if (response.notification.request.trigger?.isKind(of: UNPushNotificationTrigger.classForCoder()))! {
            JPUSHService.handleRemoteNotification(userinfo)
        }
        completionHandler()
    }
`@objc func JPushDidReciveData(notification:Notification) {
        let ex = notification.userInfo
        print(ex)
    }`

(孤独终老) #4

2楼的代码有问题吗?


#5

代码的自行与极光 demo 的代码对照。关于自定义消息的配置
https://docs.jiguang.cn/jpush/client/iOS/ios_api/#_51

可跑一下极光官方的 demo ,看下在你的环境下是否正常

以及你推送的是自定义消息吗?