简体   繁体   English

静默通知不会在TestFlight中发送

[英]Silent Notifications Won't Send In TestFlight

My app relies heavily on silent notifications to send data to the user. 我的应用程序严重依赖静默通知来将数据发送给用户。 This feature works fine in development but when I test with TestFlight it doesn't work. 此功能在开发中效果很好,但是当我使用TestFlight进行测试时,此功能不起作用。 I read that is a possible bug in some iOS versions but I'm not running any of them. 我读到这在某些iOS版本中可能是一个错误,但我没有运行其中的任何一个。 I'm using parse to send the push notifications and it says that the notifications are sent but it's not executing any of the code it didReceiveRemoteNotification Does anyone have any idea why this isn't working? 我正在使用parse发送推式通知,它说发送了通知,但是没有执行它的didReceiveRemoteNotification代码。有人知道为什么它不起作用吗?

Parse.Push.send({
    where: pushQuery,
    data: {
        "content-available" : 1,
        "sound" : "",
        "time" : alarmTimeDate,
    },
    push_time: alarmTime
}, { }).then(function() {
    response.success("Push was sent successfully.")
}, function(error) {
    response.error("Push failed to send with error: "
+ error.message);
});
},

error: function(user, error) { // error is an instance of Parse.Error. } });

 });

So I finally have come to a conclusion. 所以我终于得出了结论。 It turns out in iOS 8 silent notifications do not guarantee an execution of the code in didReceiveRemoteNotification while using production certificates. 事实证明,在iOS 8中,静默通知不能保证使用生产证书时在didReceiveRemoteNotification执行代码。 In development it works the same as it did in iOS 7, but not in production. 在开发中,它的工作原理与在iOS 7中相同,但在生产环境中却没有。 You can read more about this here. 您可以在此处了解更多信息 "Apple are not acknowleding this change in background behaviour as a bug, they acknowledge the change but say its intentional." “苹果公司没有将这种背景行为的改变视为错误,他们承认这种改变,但是说这是故意的。” - mungbeans - 绿豆

Hope this helped anyone with the same question, sorry to inform you of this news. 希望这对任何有相同问题的人有所帮助,很抱歉将此消息通知您。 As a result of this I needed to rebuild my whole app. 因此,我需要重建整个应用程序。

In development, I assume you're using a development provisioning profile tied to the push certificate you've configured on Parse. 在开发中,我假设您正在使用与您在Parse上配置的推送证书绑定的开发配置文件。

When you use TestFlight, you're required to use a Release provisioning profile. 使用TestFlight时,需要使用发布设置配置文件。 That profile would be tied to a different push certificate. 该配置文件将绑定到其他推送证书。 So, if you haven't configured a release push certificate (and enabled push on your app id for distribution), that is why you're not seeing pushes in TestFlight builds. 因此,如果您尚未配置发布推送证书(并在应用程序ID上启用推送以进行分发),这就是为什么在TestFlight构建中看不到推送的原因。

I haven't use Parse for push before, but in Urban Airship, for instance, they make it easy for you to configure a dev and release certificate for a single app. 我以前没有使用过Parse进行推送,但是例如在Urban Airship中,它们使您可以轻松地为单个应用程序配置开发和发布证书。

Hope that helps! 希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM