After following the steps indicated in the docs and in the repos, Single Message is working with the image, but the default carousel has issues. Specifically, the notification shows up, the options for Back, Next, View in App shows up after tap and hold, but the images does not show. And clicking either of the actions only suspends the notification and goes to the url we are using for redirection.
Below are the details about the issue we encountered when integrating CleverTap's Rich Push Notifications Feature.
Thank you.
Observations
Aside from the notification being blank, when clicking back, next or view app, it just suspends notification.
We haven't used the custom key-value pairs, but the question is, is it necessary?
What exactly is the needed change on MainInterface.storyboard?
only willPresentNotification & didRegisterForRemoteNotificationsWithDeviceToken is being called during testing.
There's a bit recent issue in this repo that is somewhat similar. But even if we made sure that the test image is jpg and less than 40KB, it still does not show.
We are testing this in a test CT project.
Configuration
Package
Version
Test Devices iOS Version
17.2.1 (iPhone 14), 15.8 (iPhone 6s)
Minimum Target Deployment
11.0
XCode
15.2
CleverTap-iOS-SDK
5.2.1
clevertap-react-native
1.2.1
CTNotificationContent
0.2.5
CTNotificationService
0.1.5
Pod File
...
platform :ios, '11.0'
pod "CleverTap-iOS-SDK", '5.2.1'
...
target 'NotificationService' do
pod 'CTNotificationService', :modular_headers => true
end
target 'NotificationContent' do
pod "CTNotificationContent"
end
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self initializeClevertap];
#if DEBUG
NSLog(@"DEBUG: %d", DEBUG);
[CleverTap setDebugLevel:CleverTapLogDebug];
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
#endif
if(lOptions == nil) {
lOptions = launchOptions;
}
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"Booky"
initialProperties:nil];
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
[RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
[[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
return YES;
}
...
- (void) initializeClevertap {
[CleverTap autoIntegrate]; // integrate CleverTap SDK using the autoIntegrate option
[self registerPush]; // register for APN
[[CleverTapReactManager sharedInstance] applicationDidLaunchWithOptions:lOptions];
}
...
- (void)registerPush {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
UNNotificationAction *action1 = [UNNotificationAction actionWithIdentifier:@"action_1" title:@"Back" options:UNNotificationActionOptionNone];
UNNotificationAction *action2 = [UNNotificationAction actionWithIdentifier:@"action_2" title:@"Next" options:UNNotificationActionOptionNone];
UNNotificationAction *action3 = [UNNotificationAction actionWithIdentifier:@"action_3" title:@"View In App" options:UNNotificationActionOptionNone];
UNNotificationCategory *cat = [UNNotificationCategory categoryWithIdentifier:@"CTNotification" actions:@[action1, action2, action3] intentIdentifiers:@[] options:UNNotificationCategoryOptionNone];
[center setNotificationCategories:[NSSet setWithObjects:cat, nil]];
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
if( !error ){
dispatch_async(dispatch_get_main_queue(), ^(void) {
[[UIApplication sharedApplication] registerForRemoteNotifications];
});
}
}];
}
...
/** For iOS 10 and above - Foreground, NOTE: Also works for iOS 8 **/
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{
/**
Use this method to perform the tasks associated with your app's custom actions. When the user responds to a notification, the system calls this method with the results. You use this method to perform the task associated with that action, if at all. At the end of your implementation, you must call the completionHandler block to let the system know that you are done processing the notification.
You specify your app's notification types and custom actions using UNNotificationCategory and UNNotificationAction objects.
You create these objects at initialization time and register them with the user notification center. Even if you register custom actions, the action in the response parameter might indicate that the user dismissed the notification without performing any of your actions.
If you do not implement this method, your app never responds to custom actions.
see https://developer.apple.com/reference/usernotifications/unusernotificationcenterdelegate/1649501-usernotificationcenter?language=objc
**/
NSLog(@"%@: will present notification: %@", self.description, notification.request.content.userInfo);
/** NOTE: As of CT SDK Version 5.2.1, this triggers Push Impressions / Impressions on Campaign Stat page, not Notification Viewed as indicated by name! **/
[[CleverTap sharedInstance] recordNotificationViewedEventWithData:notification.request.content.userInfo];
// if you wish CleverTap to record the notification open and fire any deep links contained in the payload, NOTE: This triggers Notification Clicked automatically
// [[CleverTap sharedInstance]handleNotificationWithData:notification.request.content.userInfo openDeepLinksInForeground: NO];
completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
}
...
/** NOTE: This is the only one triggered in testing the happy path, other than willPresentNotification **/
- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
#if DEBUG
NSLog(@"%@: registered for remote notifications: %@", self.description, deviceToken.description);
#endif
}
After following the steps indicated in the docs and in the repos, Single Message is working with the image, but the default carousel has issues. Specifically, the notification shows up, the options for Back, Next, View in App shows up after tap and hold, but the images does not show. And clicking either of the actions only suspends the notification and goes to the url we are using for redirection.
Below are the details about the issue we encountered when integrating CleverTap's Rich Push Notifications Feature.
Thank you.
Observations
MainInterface.storyboard
?willPresentNotification
&didRegisterForRemoteNotificationsWithDeviceToken
is being called during testing.Configuration
17.2.1
(iPhone 14),15.8
(iPhone 6s)11.0
15.2
CleverTap-iOS-SDK
5.2.1
clevertap-react-native
1.2.1
CTNotificationContent
0.2.5
CTNotificationService
0.1.5
Pod File
NotificationService
NofificationService.h
NotificationService.m
Info.plist
NotificationContent
NotificationViewController.h
NotificationViewController.m
Info.plist
AppDelegate.m