Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push notification through Parse using TestFlight

I know there are many question like this out there but I have tried multiple things and I still can't seem to get Push notifications to work through Parse with Apps installed through Test flight.

If I Connect my phone and download the app through Xcode, It works perfect. But if I upload the same build to Testflight and try to send a push, Nothing happens.

Some people have said that theres production certificate and developer certificate. Or it could be sandbox tokens. But I'm not sure how to fix these issues.

I already added production and development SSL Certificates to Parse.

PS. Im Building with a developer Provisioning Profile and I Export a AD HOC Developer.

My App Delegate Code is ..

#import "AppDelegate.h"
#import <Parse/Parse.h>
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [Parse setApplicationId:@"----I have mine in----"
                  clientKey:@"----I have mine in----"];
    //-- Set Notification
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }
    else
    {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }

    //--- your custom code
    return YES;
}





- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    // Store the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    [currentInstallation saveInBackground];
}

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [PFPush handlePush:userInfo];
}

If you need other code I will provide. How do I get Push Notifications to Work through Test Flight

like image 439
huddie96 Avatar asked Nov 19 '14 20:11

huddie96


1 Answers

I'm answering my own question: Your provisioning profile must contain a push certificate for production/ distribution (still has to be a developer profile though) . Since test flight works on a production level it won't work with just a developer push certificate (add both). Any other question on this just ask. I've gone through a lot of trouble shooting

like image 60
huddie96 Avatar answered Sep 28 '22 04:09

huddie96