Created
December 19, 2012 10:15
-
-
Save 3dd13/4335732 to your computer and use it in GitHub Desktop.
Convert the apn token collected from iOS to the format apn_on_rails is expecting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the apn push token you collected from mobile is in this format: | |
# 00ea74e76a873e8e9c14c2dd2afe3b42abb35148e94042811e2b6985072641f2 | |
# | |
# but actually, apn_on_rails is expecting this: | |
# 00ea74e7 6a873e8e 9c14c2dd 2afe3b42 abb35148 e9404281 1e2b6985 072641f2 | |
def format_apn_token(text) | |
text && text.gsub(/(.{8})(?=.)/, '\1 \2') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment