nomad-cli / houston

Apple Push Notifications; No Dirigible Required
http://nomad-cli.com
MIT License
2.93k stars 229 forks source link

No result after sending a push #80

Closed quantumpotato closed 9 years ago

quantumpotato commented 9 years ago

EDIT: Using Houston::Client.production has no affect. puts notification.error prints out nothing.

Following tutorial, nothing useful is logged or returned. My pushes aren't arriving.

I've tried removing spaces and <> too.

Using rspec 3.1.0
Using simplecov-html 0.8.0
require 'houston'

# Environment variables are automatically read, or can be overridden by any specified options. You can also
# conveniently use `Houston::Client.development` or `Houston::Client.production`.
APN = Houston::Client.development
APN.certificate = File.read("/Users/quantum/Documents/cliqupprodcerts.pem")

# An example of the token sent back when a device registers for notifications

token = "tokentoken"
# Create a notification that alerts a message to the user, plays a sound, and sets the badge on the app
notification = Houston::Notification.new(device: token)
notification.alert = "Hello, World!"

# Notifications can also change the badge count, have a custom sound, have a category identifier, indicate available Newsstand content, or pass along arbitrary data.
notification.badge = 57
notification.sound = "sosumi.aiff"
notification.category = "INVITE_CATEGORY"
notification.content_available = true
notification.custom_data = {foo: "bar"}

# And... sent! That's all it takes.
v = APN.push(notification)
puts v
~
lukasnagl commented 9 years ago

You could try to print the errors using notification.error, but from a first look it seems that you use the development Houston client with the production certificate:

APN = Houston::Client.development
APN.certificate = File.read("/Users/quantum/Documents/cliqupprodcerts.pem")

If you try to test the production environment, it should be Houston::Client.production.

quantumpotato commented 9 years ago

Using .production has no effect. puts notification.error prints out nothing.

samanthamjohn commented 9 years ago

Having the exact same issue. Have checked all my certs and they all seem correct. Definitely not using anything with development and no push notifications are being sent.

EDIT: some devices receive push notifications, others do not, unclear what causes this. Is Houston doing something on apple's end that messes things up?

sgwilym commented 9 years ago

Same on this issue. Have double, triple checked certs and they all check out. No errors reported, notifications supposedly sent, but nothing ever arrives. Development seems to work fine though.

Edit: Push notifications are arriving when sent from https://github.com/noodlewerk/NWPusher, so definitely something going on with Houston. Wish I could give more helpful information, but I’ve got nothing to go on.

quantumpotato commented 9 years ago

@sgwilym when you're using Development is that run directly from Xcode as opposed to an ad-hoc build?

@samjohn Are push notifications enabled for all devices? I remember a couple years ago working with Urban Airship that new push notifications could take an hour to send. Did they still not come through?

I tried logging with PersistentConnectionLogging.mobileconfig from https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG24 - nothing useful. The device registers fine it just never receives messages. I'm inclined to think the issue is with Houston.

Unfortunately, UA has completely disabled their original push notification service. I don't know of a reputable company to test with besides Houston.

sgwilym commented 9 years ago

@quantumpotato I've tested both a development build of my app with push notifications being sent from a development server (and certificates, etc.), and an adhoc build from a "production" server (ditto). I've only ever had success with Houston running on the development server sending to the development app, whereas notifications from NWPusher are come through both dev and production/adhoc.

quantumpotato commented 9 years ago

@sgwilym Damn, so it won't work for AppStore. This NWPusher? https://github.com/noodlewerk/NWPusher

sgwilym commented 9 years ago

@quantumpotato That's the one. I've also tried out https://github.com/grocer/grocer to see if I had any luck with that but no luck either. But the certificates are fine and work with NWPusher. I feel like I'm going mad!

samanthamjohn commented 9 years ago

I tried NWPusher as well and it did not work. Now it seems like some devices are receiving notifications and some are not.

I think I need to investigate further. It would be nice if houston did return an error when a push notification failed to send

Thanks for your help @quantumpotato, I will let you know if more information comes thru

quantumpotato commented 9 years ago

Ah, Pusher is just a Mac app.. not something you can run on a deployed server eg on amazon

On Mon, Oct 13, 2014 at 3:28 PM, Samuel Gwilym notifications@github.com wrote:

@quantumpotato https://github.com/quantumpotato That's the one. I've also tried out https://github.com/grocer/grocer to see if I had any luck with that but no luck either. But the certificates are fine and work with NWPusher. I feel like I'm going mad!

— Reply to this email directly or view it on GitHub https://github.com/nomad/houston/issues/80#issuecomment-58942210.

quantumpotato commented 9 years ago

@samjohn are those devices which are not on iOS8? Apple broke the API for registering for push notifications.

http://stackoverflow.com/questions/24216632/remote-notification-ios-8

#ifdef __IPHONE_8_0
    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound
|UIRemoteNotificationTypeAlert) categories:nil];
    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
#else
    UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes];
#endif
samanthamjohn commented 9 years ago

@quantumpotato I have very similar code in my app so I don't think it's that.

I actually think what might have been happening was that the apple server sometimes takes a long time for notifications to come through (or something..) some of the notifications that I sent this weekend only showed up later today in people's missed list. I think this issue is resolved for me.

quantumpotato commented 9 years ago

@samjohn Can you confirm houston is working for you, albiet delayed?

samanthamjohn commented 9 years ago

Yes, right now it is. Thanks!

Get the latest from Hopscotch!

Sign-up for our newsletter http://eepurl.com/Ui0eX

On Mon, Oct 13, 2014 at 7:11 PM, quantumpotato notifications@github.com wrote:

@samjohn https://github.com/samjohn Can you confirm houston is working for you, albiet delayed?

— Reply to this email directly or view it on GitHub https://github.com/nomad/houston/issues/80#issuecomment-58968337.

sgwilym commented 9 years ago

After some more investigation, it looks like I’m experiencing issue https://github.com/nomad/houston/issues/79, with the connection being silently dropped if any device tokens are bad. Looks like this remains a problem.

mattt commented 9 years ago

Active discussion on #72.