加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 17:55:00 所属栏目:百科 来源:网络整理
导读:我知道有很多这样的问题,但是我已经尝试了很多东西,我似乎仍然无法通过Parse安装通过测试航班安装的应用程序获得推送通知. 如果我连接手机并通过Xcode下载应用程序,它的工作非常完美.但是,如果我将相同的构建上传到Testflight并尝试发送推送,则没有任何反应.
我知道有很多这样的问题,但是我已经尝试了很多东西,我似乎仍然无法通过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];
}

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

解决方法

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读