PushMeBaby does not work!

I am trying to send a push notification through the PushMeBaby application according to [this tutorial,] [1], but I don't know why this does not work! I install the iPusher app from itunes and it works great! here is my code:

- (id)init { self = [super init]; if(self != nil) { self.deviceToken = @"5ce090e5 78d38a8a 149dbe46 cbe87e2e dc6c6d2a 4b97e3b7 a5d3f4c2 b09faad2"; self.payload = @"{\"aps\":{\"alert\":\"You got a new message!\",\"badge\":5,\"sound\":\"beep.wav\"},\"acme1\":\"bar\",\"acme2\":42}"; self.certificate = [[NSBundle mainBundle] pathForResource:@"aps_developer_identity" ofType:@"cer"]; } return self; } 

URBan AirShip Code:

  (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { // TODO: Pass the token to our server // Convert the token to a hex string and make sure it all caps NSMutableString *tokenString = [NSMutableString stringWithString:[[deviceToken description] uppercaseString]]; [tokenString replaceOccurrencesOfString:@"<" withString:@"" options:0 range:NSMakeRange(0, tokenString.length)]; [tokenString replaceOccurrencesOfString:@">" withString:@"" options:0 range:NSMakeRange(0, tokenString.length)]; [tokenString replaceOccurrencesOfString:@" " withString:@"" options:0 range:NSMakeRange(0, tokenString.length)]; // Create the NSURL for the request NSString *urlFormat = @"https://go.urbanairship.com/api/device_tokens/%@"; NSURL *registrationURL = [NSURL URLWithString:[NSString stringWithFormat: urlFormat, tokenString]]; // Create the registration request NSMutableURLRequest *registrationRequest = [[NSMutableURLRequest alloc] initWithURL:registrationURL]; [registrationRequest setHTTPMethod:@"PUT"]; // And fire it off NSURLConnection *connection = [NSURLConnection connectionWithRequest:registrationRequest delegate:self]; [connection start]; NSLog(@"We successfully registered for push notifications"); } - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error { // Inform the user that registration failed NSString* failureMessage = @"There was an error while trying to / register for push notifications."; UIAlertView* failureAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:failureMessage delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [failureAlert show]; [failureAlert release]; } - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { // Check for previous failures if ([challenge previousFailureCount] > 0) { // We've already tried - something is wrong with our credentials NSLog(@"Urban Airship credentials invalid"); return; } // Send our Urban Airship credentials NSURLCredential *airshipCredentials = [NSURLCredential credentialWithUser:@"<GY__T8X4Rg6onkJSO8o0Bg>" password:@"<Z_fhEasrQ6emwFcWMyiKrA>" persistence:NSURLCredentialPersistenceNone]; [[challenge sender] useCredential:airshipCredentials forAuthenticationChallenge:challenge]; } 
+2
source share
1 answer

I read the tutorial that you followed on mobiforge and it is wrong on many levels!

If you want to use push notifications, then there really is no better way than using Urban Airship

Here are a couple of tutorials to help you launch and use Urban Airship: Part 1 and Part 2 (I can also check if they work correctly, as I followed them many times)

If you want to avoid using a third party and instead have access to your own PHP server, here is another pair of tutorials that will help you set up: Part 1 and Part 2

+2
source

All Articles