Permalink
Browse files

updating readme again

  • Loading branch information...
1 parent c2ec8c2 commit 1cdd0f343c0e410d44950692bb2dd047853e562a @jpoz committed Jul 9, 2009
Showing with 32 additions and 27 deletions.
  1. +2 −0 .gitignore
  2. +30 −27 README.textile
  3. BIN pkg/apns-0.0.1.gem
View
@@ -0,0 +1,2 @@
+.DS_Store
+pkg
View
@@ -2,12 +2,9 @@ h2. Apple Push Notification Service
h3. Install
-<pre>
- <code>
- gem sources -a http://gems.github.com
- sudo gem install jpoz-apns
- </code>
-</pre>
+gem sources -a http://gems.github.com
+
+sudo gem install jpoz-apns
h3. Setup:
@@ -16,10 +13,16 @@ Set what host, port, pem file and password on the APNS class:
<pre>
<code>
- APNS.host = 'gateway.push.apple.com' # gateway.sandbox.push.apple.com is default
- APNS.port = 2195 # this is also the default. Shouldn't ever have to set this, but just Apple goes crazy, you can.
- APNS.pem = '/path/to/pem/file' # openssl pkcs12 -in cert.p12 -out cert.pem -nodes -clcerts
- APNS.pass = 'secret'
+APNS.host = 'gateway.push.apple.com'
+# gateway.sandbox.push.apple.com is default
+
+APNS.port = 2195
+# this is also the default. Shouldn't ever have to set this, but just Apple goes crazy, you can.
+
+APNS.pem = '/path/to/pem/file'
+# openssl pkcs12 -in cert.p12 -out cert.pem -nodes -clcerts
+
+APNS.pass = 'secret'
</code>
</pre>
@@ -29,11 +32,11 @@ Then to send a push notification you can either just send a string as the alert
<pre>
<code>
- device_token = '123abc456def'
-
- APNS.send_notification(device_token, 'Hello iPhone!' )
- # or
- APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default')
+device_token = '123abc456def'
+
+APNS.send_notification(device_token, 'Hello iPhone!' )
+
+APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default')
</code>
</pre>
@@ -43,16 +46,16 @@ You can send other application specific information as well.
<pre>
<code>
- APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default',
- :other => {:sent => 'with apns gem'})
+APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default',
+ :other => {:sent => 'with apns gem'})
</code>
</pre>
This will add the other hash to the same level as the aps hash:
<pre>
<code>
- {"aps":{"alert":"Hello iPhone!","badge":1,"sound":"default"},"sent":"with apns gem"}
+{"aps":{"alert":"Hello iPhone!","badge":1,"sound":"default"},"sent":"with apns gem"}
</code>
</pre>
@@ -64,15 +67,15 @@ After you setup push notification for your application with Apple. You need to a
ApplicationAppDelegate.m
<pre>
<code>
- - (BOOL)application:(UIApplication *)application
- didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge)];
- }
-
- - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
- NSLog(@"deviceToken: %@", deviceToken);
- }
+- (BOOL)application:(UIApplication *)application
+didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge)];
+}
+
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
+ NSLog(@"deviceToken: %@", deviceToken);
+}
</code>
</pre>
View
Binary file not shown.

0 comments on commit 1cdd0f3

Please sign in to comment.