Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APNS does not return a response #73

Closed
mrinterweb opened this issue Dec 3, 2015 · 4 comments
Closed

APNS does not return a response #73

mrinterweb opened this issue Dec 3, 2015 · 4 comments

Comments

@mrinterweb
Copy link

I am trying to write code that tracks the delivery of push notifications. The response I always get from calling APNS.send_notification is always nil. GCM.send_notification gives me a response hash. With just a nil response, I have no way of knowing if the notification was delivered for APNS. In development the push notifications are delivered, still with a nil response. In production (with TestFlight, the production gateway URL, and my production pem), notifications are not delivered and the response is still nil. I don't know what to do if I can't verify the response from APNS.send_notification.

Here is the code where I am calling APNS.send_notification:

    def push_to_ios_clients
      was_successful = true
      APNS.start_persistence
      pending_ios_clients.each do |client|
        result = APNS.send_notification(client.push_id, apns_data)
        logger.info "APNS response: #{result.inspect}" # result is always nil
        # todo - need to be able to verify response to determine if notification was sent
      end
      was_successful
    ensure
      APNS.stop_persistence
    end
@mklb
Copy link

mklb commented Dec 11, 2015

I have the same problem. If I find a solution I´ll post it

@mklb
Copy link

mklb commented Dec 11, 2015

so in general - APNS does not response anything. It´s a black box. So nil will always be the response.

My problem was that I didn´t have a matching provisioning profile and certificates. So my advice would be to check xcode and the apple developer portal out.

(a good tutorial for the certificate stuff: http://quickblox.com/developers/How_to_create_APNS_certificates - Always helps me to remember these horrible steps)

Hope I could help ;D

@mrinterweb
Copy link
Author

Thanks @mklb. After doing more research into how the APNS protocol works, I began to realize how getting a response from the binary protocol would not be possible (or at least I could not find any APNS docs on getting a response). It is just fire-and-forget. I dislike services like this, and I hope that one day Apple improves the APNS API. Apple should take inspiration from Google's GCM.

I eventually realized that the problem I was having with delivering push notifications in production was that I wasn't using the correct provisioning profile. There are so many steps in the complicated dance that is APNS configuration.

I'm going to close this issue, as I don't think there can be a meaningful resolution. PushMeUp could return true instead of nil, but really it would not make much of a difference as there is no response from APNS in the first place.

@MaicolBen
Copy link

MaicolBen commented Nov 1, 2016

Is this still true? I got a response from Apple saying: "move to the http/2 protocol that gives an ack for every push."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants