How to use the PushMeBaby sample to send Apple Push notifications?

I am trying to use the APN Server application for the PushMeBaby application to send push notifications to my device. I have an adhoc distribution application. For my application id, I created both ssl certificates for development and production. It seems that you are not sending push notifications from the PushMeBaby application, I have alread that installed Push SSL certificates in the tool chain .. it still seems to be not working.

2010-02-01 07:20:49.578 PushMeBaby[7193:a0f] MakeServerConnection(): 0 2010-02-01 07:20:49.613 PushMeBaby[7193:a0f] SSLNewContext(): 0 2010-02-01 07:20:49.614 PushMeBaby[7193:a0f] SSLSetIOFuncs(): 0 2010-02-01 07:20:49.614 PushMeBaby[7193:a0f] SSLSetConnection(): 0 2010-02-01 07:20:49.615 PushMeBaby[7193:a0f] SSLSetPeerDomainName(): 0 2010-02-01 07:20:49.631 PushMeBaby[7193:a0f] SecKeychainOpen(): 0 2010-02-01 07:20:49.648 PushMeBaby[7193:a0f] SecCertificateCreateFromData(): 0 2010-02-01 07:20:49.655 PushMeBaby[7193:a0f] SecIdentityCreateWithCertificate(): 0 2010-02-01 07:20:49.656 PushMeBaby[7193:a0f] SSLSetCertificate(): 0 2010-02-01 07:20:52.353 PushMeBaby[7193:a0f] SSLHandshake(): 0 2010-02-01 07:20:57.954 PushMeBaby[7193:a0f] SSLWrite(): 0 144 

Above is the xcode PusheBaby application log.

+4
source share
4 answers

OK - figured it out.

The device icon I was passing through (which I received from UrbanAirship) did not have spaces. I used the device token from the console from the iPhone application in this wonderful tutorial (http://mobiforge.com/developing/story/programming-apple-push-notification-services), which has spaces between every 8 characters in a line. It did the trick.

The device marker should look like this: 38c866dd bb323b39 ffa73487 5e157ee5 a85e0b7c e90d56e9 fe145bcc 6c2c594b

Later - when you look at the NSLog from PushMeBaby - you will see that the "processed" account in the SSLWrite call increased by 1 (mine went from 104 to 105) for example 2011-04-28 11: 21: 41.543 PushMeBaby [49218: 903] SSLWrite (): 0 105

Hope this helps someone else who fought like me for a few days ...

+10
source

Just thought that I would add my two cents here, as that is me too. If you understand that the device token must have spaces, then to prevent this problem from happening again, replace this section of code:

  // Validate input. if(self.deviceToken == nil || self.payload == nil) { return; } 

with this:

  // Validate input. if(self.deviceToken == nil || self.payload == nil) { return; } else if(![self.deviceToken rangeOfString:@" "].length) { //put in spaces in device token NSMutableString* tempString = [NSMutableString stringWithString:self.deviceToken]; int offset = 0; for(int i = 0; i < tempString.length; i++) { if(i%8 == 0 && i != 0 && i+offset < tempString.length-1) { //NSLog(@"i = %d + offset[%d] = %d", i, offset, i+offset); [tempString insertString:@" " atIndex:i+offset]; offset++; } } NSLog(@" device token string after adding spaces = '%@'", tempString); self.deviceToken = tempString; } 
0
source

yes for push me baby device marker must be

 45f62964 06523099 b66017f7 0eb3ea7d 14140c11 af6f14a0 c24145d1 90005763 not <45f62964 06523099 b66017f7 0eb3ea7d 14140c11 af6f14a0 c24145d1 90005763> or 45f6296406523099b66017f70eb3ea7d14140c11af6f14a0c24145d190005f9c 

if you turned on <> it goes into an endless loop in NSScanner

Although officially the device token should include <> and spaces, because this is what you get when you register if you use it in other applications, such as APN TESTER on MAC APP STORE

 <45f62964 06523099 b66017f7 0eb3ea7d 14140c11 af6f14a0 c24145d1 90005763> 
0
source

Just add it before.

 // Convert string into device token data. 

before -(IBAction)push:(id)sender; in ApplicationDelegate.h .

 if (![self.deviceToken rangeOfString:@" "].length) { NSMutableString *string = [self.deviceToken mutableCopy]; for (int i = 8; i < string.length; i+=8) { [string insertString:@" " atIndex:i]; } self.deviceToken = string; } 

And now the "no spaces" format is supported for you.

0
source

Source: https://habr.com/ru/post/1299910/


All Articles