Upgrading from 6.2.0 to 6.3.0

The Helpshift SDK v6.3.0 is a major update and we have deprecated some APIs. If you have questions or feedback, please Contact Us

Please replace all the old files with new files.

List of deprecated APIs

Deprecated API New API
[HelpshiftSupport log:(NSString *), ...>] [HelpshiftSupport addLog:(NSString *)]
[HelpshiftCampaigns getCountOfUnreadMessages] [HelpshiftCampaigns requestUnreadMessagesCount]

Add Logs

On SDK version 6.2.0 or below, the logs can be added using below code:

- (void) userUpdatedSomeSetting:(NSString *)settingName {
    ...
    [HelpshiftSupport log:@"User updated setting: %@", settingName];
    ...
}

On SDK version 6.3.0, a new api is introduced to add logs which is also Swift compatible

- (void) userUpdatedSomeSetting:(NSString *)settingName {
    ...
    NSString *message = [NSString stringWithFormat:@"User updated setting: %@", settingName];
    [HelpshiftSupport addLog:message];
    ...
}

Show count of unread campaign messages

On SDK version 6.2.0 or below, unread campaigns messages count can be obtained both synchronously and could result in a deadlock. This is changed in SDK version 6.3.0 and unread message count is always obtained asynchronously.

As an example, if you want to show the unread campaigns messages in one of the view controllers and you're on SDK 6.2.0 or earlier versions, you would use code like shown below:

#import "HelpshiftCampaigns.h"

@interface MyViewController:UIViewController

@property (nonatomic, weak) IBOutlet UILabel *label; // Label that will show unread messages count

@end

@implementation MyViewController
- (void) viewDidLoad {
    NSInteger count = [HelpshiftCampaigns getCountOfUnreadMessages];
    [self.label setText:[NSString stringWithFormat:@"%ld",(long)count]];
}

@end

On SDK version 6.3.0, you can retrieve the unread campaigns messages count and display the count as shown below:

#import "HelpshiftCampaigns.h"

@interface MyViewController:UIViewController <HelpshiftCampaignsDelegate>

@property (nonatomic, weak) IBOutlet UILabel *label; // Label that will show unread messages count

@end

@implementation MyViewController

- (void) viewDidLoad {
    [HelpshiftCampaigns sharedInstance] setDelegate:self];
    [HelpshiftCampaigns requestUnreadMessagesCount];
}


#pragma mark - HelpshiftCampaignsDelegate
- (void) didReceiveUnreadMessagesCount:(NSInteger)count {
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.label setText:[NSString stringWithFormat:@"%ld",(long)count]];
    });
}

@end