使用TestFlight通过Parse推送通知

时间:2014-11-19 20:03:28

标签: xcode parse-platform push-notification

我知道有很多这样的问题,但是我尝试了很多东西,而且我仍然无法通过Parse安装通过测试航班安装的应用程序来获取推送通知。

如果我连接手机并通过Xcode下载应用程序,那就完美了。但是,如果我将相同的构建上传到Testflight并尝试发送推送,则没有任何反应。

有些人说有生产证书和开发人员证书。或者它可能是沙盒令牌。但我不确定如何解决这些问题。

我已经将生产和开发SSL证书添加到Parse。

PS。我使用开发人员配置文件和我导出AD HOC开发人员。

我的应用代表代码是..

#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];
}

如果您需要其他代码,我会提供。 如何通过测试飞行获得推送通知

1 个答案:

答案 0 :(得分:5)

我正在回答我自己的问题: 您的配置文件必须包含用于生产/分发的推送证书(但仍然必须是开发人员配置文件)。 由于测试飞行在生产级别上工作,因此仅使用开发人员推送证书(添加两者)不起作用。 关于此的任何其他问题只是问。我经历了很多麻烦的拍摄

相关问题