Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Delegate #4

Closed
FarshidRoohi opened this issue Sep 29, 2020 · 8 comments
Closed

Issue Delegate #4

FarshidRoohi opened this issue Sep 29, 2020 · 8 comments

Comments

@FarshidRoohi
Copy link

FarshidRoohi commented Sep 29, 2020

Problem Not Work Delegate
When receive Notification The pushClientManagerDidReceivedMessage method is not called

test iOS 14, Xcode 12
SDK : pod 'ChabokPush', '~> 2.2.0'

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        
        PushClientManager.resetBadge()
        PushClientManager.default()?.addDelegate(self)
        PushClientManager.default()?.configureEnvironment(.Sandbox)
        
        
        return true
    }

func pushClientManagerDidReceivedMessage(_ message: PushClientMessage!) {
        print("message  : \(String(describing: message))")

//        let body = message?.notification["body"] as? String
//        let title = message?.notification["title"] as? String
//        let subtitle = message?.notification["subtitle"] as? String
//
//        print("body : \(String(describing: body)) title : \(String(describing: title)) | subtitle : \(String(describing: subtitle))")
//
//        if let chabokPayload = message?.toDict {
//            print("\n\n Got the Chabok message : \n \n \(String(describing: chabokPayload))")
//        }
    }
@Husseinhj
Copy link
Collaborator

pushClientManagerDidReceivedMessage is only fired when realtime parameter in your configuration file is true.

image

@FarshidRoohi
Copy link
Author

FarshidRoohi commented Sep 29, 2020

@Husseinhj realtime is active

Screen Shot 2020-09-29 at 2 14 43 PM

@Husseinhj
Copy link
Collaborator

Try uninstalling & installing again. If it didn't work, set PushClientManager.default()?.logLevel to ChabokLogLevelVerbose and send output log for us.

@Husseinhj Husseinhj reopened this Sep 29, 2020
@FarshidRoohi
Copy link
Author

20-09-29 14:30:37.725987+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: didChangeAuthorizationStatus
2020-09-29 14:30:37.727394+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: Location services autorization status is (Not Determined)
2020-09-29 14:30:37.831504+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: [-[PushClientManager applicationWillEnterForeground:]] Calling pending registration & connectToServer
2020-09-29 14:30:37.831596+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: App became foreground
2020-09-29 14:30:37.831818+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: [-[PushClientManager connectToServer]]: Connecting to server @Connecting
2020-09-29 14:30:37.835033+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: App became foreground
2020-09-29 14:30:37.873183+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: Start calling registerForRemoteNotifications in UI thread.
2020-09-29 14:30:37.890422+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: didRegisterForRemoteNotificationsWithDeviceToken called inside of SDK. <MyZarinPal_v4_iOS.AppDelegate: 0x281d574e0>
2020-09-29 14:30:37.890673+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) verbose: didRegisterForRemoteNotificationsWithDeviceToken called in SDK with deviceToken = {length = 32, bytes = 0x08405324 80674f4e 5c40eace e4df247a ... ac1c2df6 dfc70374 }
2020-09-29 14:30:37.894547+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: [-[PushClientManager application:didRegisterForRemoteNotificationsWithDeviceToken:]]: registerDeviceToServer
2020-09-29 14:30:37.894606+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: registerDeviceToServer
2020-09-29 14:30:37.895057+0330 MyZarinPal-v4-iOS[10782:3770717] (CHABOK) debug: [-[PushClientManager registerDeviceToServer]_block_invoke]: registerDeviceWithAdapter2
2020-09-29 14:30:37.897911+0330 MyZarinPal-v4-iOS[10782:3770717] SCNetworkReachabilityScheduleWithRunLoop Success
2020-09-29 14:30:39.873029+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: LBInstallation: Successfully saved <LBInstallation {
    adIdEnabled = 0;
    appBundleId = "***";
    appId = ***;
    appVersion = "2.2.0";
    badge = 0;
    buildExpire = 1632744182000;
    clientVersion = "***";
    connection = Wifi;
    developerAccountInfo =     {
        teamIdentifier = ***;
        teamName = "***";
    };
    deviceId = "***";
    deviceModel = "iPhone 8 Plus";
    deviceToken = ***;
    deviceType = ios;
    id = ***;
    installDate = 1601369056898;
    isGuest = 0;
    isLoggedIn = 0;
    isProduction = 0;
    lastLaunchTime = 1601375239346;
    launchCount = 32;
    launchTime = 1601377237614;
    launched = 1;
    locale = "en_US";
    locationAuthorization = 0;
    manufacturerId = 622ca24a78e0efa65a39f1b0d8479f22;

    newInstall = 0;
    osBuild = 18A373;
    osVersion = "14.0";
    realtime = 1;
    registerTs = 1601370483197;
    releaseMode = 1;
    screenResolution = 1080x1920;
    status = Active;
    subscriptions =     (
        default
    );
    timeZone = "Asia/Tehran";
    tokenStatus = ALLOWED;
    uniqueId = "***";
    userId = ***;
}>
2020-09-29 14:30:39.874404+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) verbose: Register user successfully
2020-09-29 14:30:39.874703+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: No registrationHandler for success
2020-09-29 14:30:39.875067+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: [-[PushClientManager handleRegistrationSuccess]]: Calling connectToServer
2020-09-29 14:30:39.876380+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: [-[PushClientManager connectToServer]]: Ignore connecting to server Connecting
2020-09-29 14:30:40.150655+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: -- Connected to server. Check storage to publish dirty event data.
2020-09-29 14:30:40.151268+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: -- Connected to server. Check storage to publish dirty event data.
2020-09-29 14:30:40.325773+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: registerDeviceToServer
2020-09-29 14:30:40.326145+0330 MyZarinPal-v4-iOS[10782:3770714] (CHABOK) debug: [-[PushClientManager registerDeviceToServer]_block_invoke]: registerDeviceWithAdapter2
2020-09-29 14:30:40.326676+0330 MyZarinPal-v4-iOS[10782:3770714] SCNetworkReachabilityScheduleWithRunLoop Success
2020-09-29 14:30:41.635023+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: LBInstallation: Successfully saved <LBInstallation {
    adIdEnabled = 0;
    appBundleId = "***";
    appId = ***;
    appVersion = "2.2.0";
    badge = 0;
    buildExpire = 1632744182000;
    clientVersion = "4.0.2.2";
    connection = Wifi;
    developerAccountInfo =     {
        teamIdentifier = ***;
        teamName = "***";
    };
    deviceId = "***";
    deviceModel = "iPhone 8 Plus";
    deviceToken = ***;
    deviceType = ios;
    id = ***;
    installDate = 1601369056898;
    isGuest = 0;
    isLoggedIn = 0;
    isProduction = 0;
    lastLaunchTime = 1601375239346;
    launchCount = 32;
    launchTime = 1601377237614;
    launched = 0;
    locale = "en_US";
    locationAuthorization = 0;
    manufacturerId = ***;

    newInstall = 0;
    osBuild = 18A373;
    osVersion = "14.0";
    realtime = 1;
    registerTs = 1601370483197;
    releaseMode = 1;
    screenResolution = 1080x1920;
    status = Active;
    subscriptions =     (
        default
    );
    timeZone = "Asia/Tehran";
    tokenStatus = ALLOWED;
    uniqueId = "***";
    userId = ***;
}>
2020-09-29 14:30:41.635707+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) verbose: Register user successfully
2020-09-29 14:30:41.635789+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: No registrationHandler for success
2020-09-29 14:30:41.635874+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: [-[PushClientManager handleRegistrationSuccess]]: Calling connectToServer
2020-09-29 14:30:41.636162+0330 MyZarinPal-v4-iOS[10782:3770522] (CHABOK) debug: [-[PushClientManager connectToServer]]: Ignore connecting to server Connected

@Husseinhj
Copy link
Collaborator

Which policy did you use for sending your message? Inbox (صندوق پیام) or Push (پوش نوتیفیکیشن)?

@FarshidRoohi
Copy link
Author

FarshidRoohi commented Sep 29, 2020

I am implementing the sandbox
And I send Push in two ways :
1- Sending a test
2- Sending push through the campaign for test users

@FarshidRoohi
Copy link
Author

//
//  AppDelegate.swift
//  MyZarinPal-v4-iOS
//
//  Created by Farshid Roohi on 2/23/20.
//  Copyright © 2020 Farshid Roohi. All rights reserved.
//

import UIKit
import AdpPushClient

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate,PushClientManagerDelegate {
        
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        
        PushClientManager.resetBadge()
        PushClientManager.default()?.addDelegate(self)
        PushClientManager.default()?.configureEnvironment(.Sandbox)
      
        PushClientManager.default()?.logLevel = ChabokLogLevel(rawValue: ChabokLogLevelVerbose.rawValue)
        
        return true
    }
    
    // MARK: UISceneSession Lifecycle
    
    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }
    
    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }


    
    func pushClientManagerDidReceivedMessage(_ message: PushClientMessage!) {
        print("message  : \(String(describing: message))")
    }
    
    func pushClientManagerDidReceivedEventMessage(_ eventMessage: EventMessage!) {
        print("eventMessage  : \(String(describing: eventMessage))")
    }
    func pushClientManagerDidDeliveredMessage(_ message: PushClientMessage!) {
        print("PushClientMessage  : \(String(describing: message))")
        
    }
    func pushClientManagerUILocalNotificationDidReceivedMessage(_ message: PushClientMessage) {
      print("pushClientManagerUILocalNotificationDidReceivedMessage : \(message)")
    }

}

and send this way :
Screen Shot 2020-09-29 at 4 05 01 PM

@Husseinhj
Copy link
Collaborator

این گزینه اقدام به ارسال پوش‌نوتیفیکیشن تستی در اپلیکیشن می‌کند و با قابلیت صندوق پیام (پیام چابک) متفاوت هست. دقت بفرمایید گزینه صندوق پیام در پنل شما غیرفعال است.

برای دریافت پیام در متد pushClientManagerDidReceivedMessage از قابلیت صندوق پیام در صفحه ایجاد کمپین استفاده کنید. همانند تصویر زیر: image

جهت دریافت دیتا پوش‌نوتیفیکیشن این بخش از مستندات رو مطالعه بفرمایید

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants