Jack
Jack

Reputation: 324

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. I read that is a possible bug in some iOS versions but I'm not running any of them. 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.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. } });

 });

Upvotes: 1

Views: 368

Answers (2)

Jack
Jack

Reputation: 324

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. In development it works the same as it did in iOS 7, but not in production. 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.

Upvotes: 1

jeffro37
jeffro37

Reputation: 706

In development, I assume you're using a development provisioning profile tied to the push certificate you've configured on Parse.

When you use TestFlight, you're required to use a Release provisioning profile. 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.

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.

Hope that helps!

Upvotes: 0

Related Questions