Another iOS Push Notification registration problem

Hi,

I’m trying to implement Push Notification in our app using using Fuse 1.4 and community push notification projects. I’ve also used the example project in the community project.

Everything works well on Android but on iOS, I couldn’t even manage to get registration to succeed. I’ve searched the forums and most of the time it was mentioned there could be something wrong with the certificates. So I have recreated them but it again didn’t work. I’ve called register() method thinking that may be it wasn’t called properly at the right time. But again, no luck. I’ve even debugged the Objective-C code blindly hoping to get a clue about what was happening but couldn’t find anything.

The thing is I couldn’t find a way or an application to check the validity of my certificates if they were the problem. I wanted to be sure that they were working correctly before I posted the issue here.

So, at the end I decided to create an iOS project in Xcode with my app signature, by copy-pasting the necessary code (by Googling) that will achieve Push Notification. And it worked! So, I am finally sure that there is nothing wrong with my certificates :slight_smile: And there is something wrong with my implementation of push notification in Fuse.

I have uploaded both my simplified fuse app and the Xcode app that I’ve created with which push notification worked on my machine and my phone. I have uploaded them to the dropbox address specified in the FAQ with the name kpax_ios_pn_problem.zip. I would kindly request that someone would check them out and tell me what I’m doing wrong.

I’m using High Sierra 10.13.1 and testing on iPhone 7 Plus with iOS 11.2.1. And my Xcode version is 9.2.

Thanks in advance,

Ipek

Hi,

Could anyone be able to find time to take a look at this issue?

Hi,

I am still struggling to get deviceToken on onRegistrationSucceeded event. As I have previously mentioned I’m sure that my certificates are working. I’ve tested them by making an Xcode project using UserNotifications framework. I’ve previously uploaded both my project using Fuse.APNS and the Xcode project that I’ve created for certificate testing which was using UserNotifications framework.

Since I couldn’t get any reply for my issue, I’ve decided to analyze the Fuse.APNS code and realized that it is using UIKit framework, not the UserNotifications framework. So, I’ve written the below simple code (again through googling) to test if everything works well on my environment using UIKit as in Fuse.APNS code.

//
//  AppDelegate.m
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound  | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)  categories:nil]];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
        
    return YES;
}

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    // custom stuff we do to register the device with our AWS middleman
    NSLog( @"didRegisterForRemoteNotificationsWithDeviceToken: %@", deviceToken );
}

@end

And it worked! didRegisterForRemoteNotificationsWithDeviceToken is triggered and I get the deviceToken. But again this didn’t help me to figure out the problem in Fuse.APNS code that doesn’t trigger onRegistrationSucceeded event in the same environment (same OS, same Xcode, same Apple account and certificates, same phone).

I am really out of options. Can someone please check it out?

Thanks in advance!

Hi ipek,

we’d love to help, but there is little point in us looking into your code, since we can’t really test it. We don’t have your certificates, so we wouldn’t be able to check if we manage to get a registration token anyway.

Since you have checked that your profiles and certificates are working fine, and have a native project registering successfully, I can only assume that there is a minor configuration issue somewhere in your Fuse project. Either you haven’t set up the right “Development team id” in your .unoproj file, or the app bundle doesn’t match the one you’ve registered with iTunes connect. It must be something that minor.

Either way, if you’re saying that “exactly the same thing works”, all you need to do is figure out the difference.

Hi Uldis,

Thanks so much for the reply!

I also think that there must be a configuration issue but no matter how much I read or struggle to try find a solution I can’t figure out the problem. I am definitely hopeless but I am also curious to find out the problem that has taken my days :slight_smile: Even opening up Xcode and writing native code was too much for me since my familiarity with Xcode and Objective-C is none.

So, if you have the time and would like to check it out, I’ve uploaded all the necessary files and the authentication information to the dropbox address with the name infini_pn_problem.zip.

I have also added readme.rtfd file that has my credentials and also explains in detail the files and the configurations that I’ve made.

Thanks again so much,

Ipek

Hi Ipek,

foremost, thank you for a simply great report right there. Used it for debugging extensively and we actually found the cause of the issue (and already fixed it, too). Before we go there, though: please change the password of your Apple ID now that we’re done with it, and revoke whatever profiles/certificates are not needed in Apple Developer Center.

So, about the root cause of the problem. A while ago, there was an internal change to how notification callbacks were handled in Uno which had been done on Fuse.APNS but that change was not pushed to master. So, the code on Fuse.APNS essentially didn’t work for… some time. Our sincere apologies for that.

Please go to the repo, pull the latest changes and it will work just fine.

Thanks Uldis,

I will take care of the passwords and certificates. I am glad that my efforts at least helped the team to find out the issue and I am relieved that after so many days I am done with this problem :slight_smile: But I actually wonder why nobody else was experiencing the same problem.

Still, thanks again for the help!

ipek wrote:
But I actually wonder why nobody else was experiencing the same problem.

That’s probably because the Fuse.APNS code worked on earlier Fuse versions that shipped with older Uno without the callbacks-change. People might have still been on those versions, so not affected.

Either way, we’re terribly sorry about this.