wireframe-apn_on_rails 0.3.0.20120130 → 0.3.0.201201301700
Sign up to get free protection for your applications and to get access to all the features.
@@ -59,11 +59,13 @@ class APN::Notification < APN::Base
|
|
59
59
|
# see http://developer.apple.com/IPhone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW4
|
60
60
|
def message_for_sending
|
61
61
|
json = self.to_apple_json
|
62
|
-
json.
|
63
|
-
message = "\0\0 #{self.device.to_hexa}\0#{(json.bytesize).chr}#{json}"
|
62
|
+
message = "\0\0 #{self.device.to_hexa}\0#{encode((json.bytesize).chr)}#{encode(json)}"
|
64
63
|
raise APN::Errors::ExceededMessageSizeError.new(message) if message.bytesize.to_i > APN::Errors::ExceededMessageSizeError::MAX_BYTES
|
65
64
|
message
|
66
65
|
end
|
66
|
+
def encode(string)
|
67
|
+
string.respond_to?(:force_encoding) ? string.force_encoding('BINARY') : string
|
68
|
+
end
|
67
69
|
|
68
70
|
class << self
|
69
71
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wireframe-apn_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 402402603487
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.3.0.
|
10
|
+
- 201201301700
|
11
|
+
version: 0.3.0.201201301700
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- ryan
|