Giter Site home page Giter Site logo

Is an app required? about apn_on_rails HOT 8 CLOSED

michaelkirk avatar michaelkirk commented on June 1, 2024
Is an app required?

from apn_on_rails.

Comments (8)

cqr avatar cqr commented on June 1, 2024

The way that certificates are stored with the application has changed fundamentally. We are talking about adding the ability to use the old-style APIs and treat your application as a single-app, but for right now this is not possible with the latest version.

Almost every change made to the gem for the latest version was to allow multiple apps, so if you are dealing with a single app, you might consider using the last version.

I will be leaving this issue open for consideration in the next release.

from apn_on_rails.

mjankowski avatar mjankowski commented on June 1, 2024

Is there an upgrade path to convert from the previous setup to new setup -- or is just "manually create an app record with your keys"?

from apn_on_rails.

michaelkirk avatar michaelkirk commented on June 1, 2024

I'm not that familiar with the code, but I think it is a manual process. You'll have to create an app with your keys, and associate all the old devices with your new app.

from apn_on_rails.

Jirapong avatar Jirapong commented on June 1, 2024

ruby script/console

> a = APN::App.new
> a.apn_dev_cert = File.read('......_push.pem')
> a.save

hope this help

from apn_on_rails.

rebeccanesson avatar rebeccanesson commented on June 1, 2024

The above comments correctly show how to create an app. But in order to make the app compatible with existing implementations without code changes the current version (0.4.1) now allows devices not associated with an APN::App and uses the certs stored in the config directory to send notifications addressed to those apps.

Thanks for the feedback leading to this change.

from apn_on_rails.

mjankowski avatar mjankowski commented on June 1, 2024

It appears that notifications are now sent via rake task, rather than as they are created - but with the fix to allow "single app" code, there are no App records for the rake task to find, and thus there are no notifications sent?

from apn_on_rails.

rebeccanesson avatar rebeccanesson commented on June 1, 2024

Hi,

The notifications can be sent by calling a method or by calling a rake task that calls a method. This has not changed in this version or in the 4.0 update. They are, as you note, not sent when they are created.

The APN::App.send_notifications method will send all unsent notifications for any APN::Apps and also any unsent notifications that are not associated with an APN::App. So even if you have not created any APN::App instances, you should call the APN::App class method to send your notifications. The old method that I deprecated (I think it is APN::Notification.send_notifications or something like that) prints a deprecation message but also calls the APN::App.send_notifications method so even if you don't change from old code that calls the deprecated method your notifications should still send.

I can't tell from your message whether you are finding that your notifications are not being sent when you call APN::App.send_notifications. I tested it out in the context of a larger Rails app using both devices/notifications not associated with an APN::App instance and ones that were. I was able to send the notifications in both cases. But of course there is always the possibility of a bug!

Thanks,
Rebecca

from apn_on_rails.

mjankowski avatar mjankowski commented on June 1, 2024

Yeah...just noticed that. I think I actually have an issue with ssl certs in my app. I'll report back here if I can't get it to work, but I see no reason why it won't work like you just described, now that I check out the code.

from apn_on_rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.