LivePersonInc / developer-center

LivePerson’s Developer Center and Community
https://developers.liveperson.com/
31 stars 199 forks source link

【iOS】How do I test offline message notification? #78

Closed josercc closed 6 years ago

josercc commented 6 years ago

My question is following link

Bancomer Movil - Push Notification issues SDK V2.7 #54

I've followed the documentation but I do not know how to test offline message notifications

Here is my code configuration

image

image

image

image

I am exporting a PEM certificate based on your documentation and I am on the APN test tool and we are in development mode to be able to test the receipt of notifications.

I derived from the development of the certificate, and my name is also added -DEV logo, closed the release of the switch. I suspend the application or shut down and apply the test, after the reply message can not receive offline message notification.

What the problem is caused by this?

dvillacis94 commented 6 years ago

Hello,

if you want to make sure that the process to create the Certificates was correct, and later on test the Push Certificate, you can follow the instructions from this document: https://developers.liveperson.com/consumer-experience-ios-sdk-sampleapp.html#creating-push-certificates-1

josercc commented 6 years ago

@dvillacis94 I try again

I tried the APN test tool My phone is normal to receive notification I also follow the document configuration is still unable to receive notification

image

image

image

image

shaymLP commented 6 years ago

@josercc Please make sure your bundle id is written correctly before the "-Dev" postfix, Follow the cert guides again. Make sure you follow the guide exactly as it written. Than send 2 messages from LiveEngage when the app is closed or in the background and reply with the exact timestamp of this messages so i can further check our backend side. (If\When push is not received)

josercc commented 6 years ago

@shaymLP

2017-11-29 09:30:00.446143+0800 GearBest[3256:529202] [2017-11-29 09:30:00.446] [0x1c0077780] [TRACE]: [ConversationViewController] [messagesStatusDidChange(_:messages:)] [L2044]: messagesStatusDidChange for conversation: << UID: Optional("193ffb09-b6cf-4e84-a902-e4ef7934980d"), handlerID: 78A7B664-0F94-4902-BB8E-59266F2C694F, state: OPEN, reationDate: 2017-11-20 02:36:15 +0000, lastMessage: Optional("test2132143241"), lastReceivedSequence: 45, numberOfMessages: 21 >>, messages: [<< UID: 78A7B664-0F94-4902-BB8E-59266F2C694F\44, Content: test2132143241, Timestamp: 2017-11-29 01:29:41 +0000, MessageType: remoteUserMsg, Status: read, OwnerConversation: 78A7B664-0F94-4902-BB8E-59266F2C694F >>]

orenkatz commented 6 years ago

@josercc what is the 'alternateBundleID' you are using in your code? can you try to remove it and test?

Avishaia commented 6 years ago

Hey, Gearbest went live with In-App but still having issues with the Push Notification. Can we open the thread again so they can provide more feedback regarding their current problem?

Thanks.

EdenKupe commented 6 years ago

Certainly, this is now reopened.

Avishaia commented 6 years ago

Hey @josercc - please write down the current progress and error you are experiencing.

Thanks.

josercc commented 6 years ago

@Avishaia The process is like this One answer above can see all of the code integration. I used to get the test using APNS test Token phone can receive the normal I generated the corresponding certificate and key file upload according to your document, and test added-DEV keyword. I send a message to customer service, then hang APP. After customer service reply, I can not receive any notification message. I guess this process is that I send a message to the customer service, your server gets my device Token. Customer service reply me, and then sent a notification offline. But I do not understand that there is a problem, it may be a problem with the uploaded certificate.

Avishaia commented 6 years ago

@shaymLP @orenkatz See message from @josercc. Appreciate your assistance here.

Avishai.

shaymLP commented 6 years ago

I don't see the 'didFinishLaunchingWithOptions' function here, please post it here too so i can review it. You can also follow this guide for extra guidance - https://www.raywenderlich.com/156966/push-notifications-tutorial-getting-started Awaiting your response, @josercc

josercc commented 6 years ago

@shaymLP Why do you want to do something in didFinishLaunchingWithOptions? Send notification you only need a push Token on it. I have already called your method when I get Token set

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//    [self fixiOS11Bug];
    GB_LOG(@"WebP 框架已经安装->%@/Library",NSHomeDirectory());

    // 开启 WebP
    [GBWebPManager openWebPSupport];
    [self settingAppRunConfiguration];
    [self setupRequestFilters];
    /// 在设置首页之前进行请求数据
    [self setupLanguages];
    [self clearOldDataBase];
    [self registerNotification];
    [self startBranchSessionWithOptions:launchOptions]; // 配置 DeepLink Branch
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = GB_COLOR_WHITE;
    self.window.rootViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
    [self.window makeKeyAndVisible];
#ifdef Release
    BOOL isAllowRun = [GBInitCheckManager check];
    if (!isAllowRun) {
        return YES;
    }
#endif
    [self initGoogleAnalytics];
    [self configGIDSignInMethod];
    [self addCookie];
    [self gb_configShareSDKId];
    [self addCriteoAppEventSDK];
    [self addCriteoUserCountryAndLanguage];
    [self showTabBarController];
    [GBBaseUtils setAppNewVersion];
    application.applicationIconBadgeNumber = 0;
    //当键盘弹起时,点击背景收起键盘
    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
#pragma mark - init LeanCloud
    [self initLeanCloudPartObjectWithOptions:launchOptions];
    [self followLeanCloudForApplication:application andOptions:launchOptions];
    [Fabric with:@[[Branch class], [Crashlytics class]]];
    [self checkInternetStatus];
    [self autoUpdateToken];
    //设置3Dtouch 指向没确定,暂时不上
//    [self set3DTouchWithLaunchOptions:launchOptions];
    //初始化SAS统计
    [[GBSasManager sharedManager] initSasTracking];
    if(([[NSProcessInfo processInfo] respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)]) &&
       [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){9, 0, 0}]) {
        [[UITextField appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
        [UITextField appearance].textAlignment = NSTextAlignmentLeft;
        [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
    }
    [GBLiveChatManager setupLiveChat];
    // 如果是正常的进入就移除进入前台保存的时间戳
    [[GBUnifyOfflineDataSaveManager shareSaveManager] removeObjectInUserDefaultForKey:kGBLastEnterBackgroundTimeDate];
    return YES;
}
shaymLP commented 6 years ago

@josercc In order to register for push notification you will need to add some basic code to your didFinishLaunchingWithOptions method like asking the user for permissions, did you follow the guides i sent you?

To Register for Push Notifications on your AppDelegate.swift file, locate the method didFinishLaunchingWithOptions, and add the following code: // Check if iOS 10.0 if #available(iOS 10.0, *) { // Register for push remote push notifications UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in // Dispatch Async Queue DispatchQueue.main.async { // LOG print("Granted::Push") // Register for Push UIApplication.shared.registerForRemoteNotifications() } } } else { // Register for push remote push notifications - Deprecated in iOS 10.0 application.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil)) // Register for Notifications application.registerForRemoteNotifications() }

Please make sure you follow both of the following guides (Liveperson guide is in swift, but you can make the necessary modifications using the 2nd guide) https://developers.liveperson.com/consumer-experience-ios-sdk-sampleapp.html#2.8step5 https://www.raywenderlich.com/156966/push-notifications-tutorial-getting-started

josercc commented 6 years ago

I am a registered notice because I can test it myself

Look this

wechatimg59

shaymLP commented 6 years ago

I didn't quite understand your response, i noticed you are passing your brand id as an alternate bundle id. Why? Please try to remove it and try again (leave it empty). Image of Yaktocat

josercc commented 6 years ago

@shaymLP I will try again

shaymLP commented 6 years ago

Dear @josercc, If you still need assistance with this please let us know, otherwise I am going to close this issue. Thanks.

josercc commented 6 years ago

@shaymLP Really sorry, our current focus is on project refactoring, and the ability to optimize LivePerson's offline notifications can be optimized before they can be resumed

Please close first