Reputation: 5410
I am trying to use apn_on_rails and followed this tutorial to configure it
The problem is that my APN::device is not creating an object properly. From rails console:
ruby-1.9.2-p290 :020 > APN::Device.create(:token => "bd1545df 8c88041c eb7171c6 xxxxxxxx xxxxxxxx")
(0.2ms) BEGIN
(0.2ms) SELECT 1 FROM `apn_devices` WHERE `apn_devices`.`token` = BINARY 'bd1545df 8c88041c eb7171c6 xxxxxxxx xxxxxxxx' LIMIT 1
(0.1ms) ROLLBACK
=> #<APN::Device id: nil, token: "bd1545df 8c88041c eb7171c6 xxxxxxxx xxxxxxxx", created_at: nil, updated_at: nil, last_registered_at: nil>
How can I fix this? I read that the problem might be from the token format. But I have tried bd1545df 8c88041c eb7171c6 xxxxxxxx xxxxxxxx and also bd1545df8c88041ceb7171c6xxxxxxxxxxxxxxxx but it doesn't work.
Any help is greatly appreciated.
Upvotes: 1
Views: 386
Reputation: 5410
What happened was that I was using the wrong device id. The device id has 8 blocks of 8 hex digits.
Also, if you try to create the same device twice the same problem appears. In rails console the devices registered can be deleted with the command:
APN::Device.destroy_all
Upvotes: 1