Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Push notifications not working on for ad hoc distributions with Test Flight

Having a bit of a weird issue...

In my AppDelegate.m I have the following:

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
    // Override point for customization after application launch.


    // Enable test flight reporting; https://testflightapp.com/sdk/doc/0.8.3/
    [TestFlight takeOff:@"myTestFlightToken"];

    // Let the device know we want to receive push notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

    return YES;
}

-(void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    NSString *tokenAsString = [[deviceToken description] 
                                 stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];

    NSLog(@"Device token: %@", deviceToken);
    User.currentUserPushNotificationToken = tokenAsString;
    [TestFlight passCheckpoint: [NSString stringWithFormat: @"Registered for remote notifications %@", deviceToken]];
}

-(void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    NSLog(@"Failed to get token, error: %@", error);
    [TestFlight passCheckpoint: [NSString stringWithFormat: @"Failed to register for remote notifications %@", error]];    
}

My team are using Test Flight to distribute ad hoc builds between the developers and stakeholders.

When I build the app on my own iPhone 4 the App asks me if I wish to allow push notifications and the app also appears in Settings > Notifications > In Notification Center

So far, so good...

When I create a development ipa and distribute this amongst the team, the other users are not asked if they wish to allow Push Notifications and this doesn't appear in Settings > Notifications...

Can anybody think of why this may be?

Update

For distribution, I'm building the app using the Team Provisioning Profile which has an "*" for the bundle ID instead of the app name - could this be the issue? This is the Team Provisioning Profile that Apple generates automatically.

like image 630
bodacious Avatar asked May 17 '12 17:05

bodacious


People also ask

Can we receive push notifications in AdHoc certified test build?

AdHoc build receives no push notifications.

Do push notifications work on TestFlight?

To send push notification to Testflight / App Store, we will need to use a production push certificate and send the push notification payload to production Apple Push Notification Server (APNS, https://api.push.apple.com) . We will look into how to generate the production APNS certificate below.

Why push notification is not working for iOS?

You can fix an iPhone that's not getting notifications by restarting it or making sure notifications are turned on. You should also make sure your iPhone is connected to the internet so apps can receive notifications. If all else fails, you should try resetting the iPhone — just make sure to back it up first.

Why are push notifications not working?

One of the main reasons why your phone's notifications aren't working could be due to broken app updates. If your Android device is not getting notifications from one app in particular, it's possible that the developers have accidentally rolled out a buggy update.


1 Answers

Yes that is the issue. You cannot have a wildcard character in an app identifier for push notification (otherwise it would push to all apps!).

like image 183
MGA Avatar answered Sep 20 '22 15:09

MGA