xcode – 使用TestFlight通过Parse推送通知

前端之家收集整理的这篇文章主要介绍了xcode – 使用TestFlight通过Parse推送通知前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道有很多这样的问题,但是我已经尝试了很多东西,我似乎仍然无法通过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];
}

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

解决方法

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

猜你在找的Xcode相关文章