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

Rich push notification not work properlly after update IPA (same IPA with overwirtten) #227

Closed
mathiarasan24 opened this issue Mar 1, 2017 · 0 comments

Comments

@mathiarasan24
Copy link

mathiarasan24 commented Mar 1, 2017

Hi,

check this stackoverflow my question.

NOTE: Modified from previously question.

I am using pod for FCM

  pod 'Firebase/Core'
  pod 'Firebase/Messaging'

In AppDelegate.m

@import UserNotifications;
@import Firebase;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

[FIRApp configure];

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {
        UIUserNotificationType allNotificationTypes =
        (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
        UIUserNotificationSettings *settings =
        [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
    } else {
        // iOS 10 or later
#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
        
        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
        center.delegate = self;
        [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
            if(!error){
                [[UIApplication sharedApplication] registerForRemoteNotifications];
            }
        }];

        // For iOS 10 display notification (sent via APNS)
        [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
        // For iOS 10 data message (sent via FCM)
        [[FIRMessaging messaging] setRemoteMessageDelegate:self];
#endif
    }
}

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    [[FIRInstanceID instanceID] setAPNSToken:deviceToken
type:FIRInstanceIDAPNSTokenTypeSandbox];
    [[FIRMessaging messaging] subscribeToTopic:@"/topics/TopicName"];
}

- (void)connectToFcm {
    [[FIRMessaging messaging] connectWithCompletion:^(NSError * _Nullable error) {
        if (error != nil) {
            NSLog(@"Unable to connect to FCM. %@", error);
        } else {
            NSLog(@"Connected to FCM.");
            
            NSLog(@"[[FIRInstanceID instanceID] token] %@ ", [[FIRInstanceID instanceID] token]);
        }
    }];
}

Then added google plist to my project

Extra: I didn't configure push certificate for Notification extension just enable in APP ID.
Here from FCM doc under add the sdk title "note". If I do, Can I create new App in FCM Console?

This what I configure for rich push notification.

I don't know where I made a mistake. If any I missed kindly let me know.

@mathiarasan24 mathiarasan24 reopened this Mar 8, 2017
@mathiarasan24 mathiarasan24 changed the title mutable-content not working in payload Rich push notification not work properlly after update IPA (same IPA with overwirtten) Mar 8, 2017
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