This may help you. I guess you are not removing the spaces in your device token.
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString *dt = [[deviceToken description]
stringByTrimmingCharactersInSet:[NSCharacterSet
characterSetWithCharactersInString:@"<>"]];
dt = [dt stringByReplacingOccurrencesOfString:@" " withString:@""];
NSURL *url = // URL of your web application ...
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
[req setHTTPMethod:@"POST"];
NSString *udid = [[UIDevice currentDevice] name]; // This is perfectly
legal. You just need to make sure it's not visible publicly.
NSString *post = [NSString stringWithFormat:@"deviceToken=%@&deviceId=%@",
dt, udid];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding
allowLossyConversion:YES];
[req setHTTPBody:postData];
NSURLConnection *conn = [NSURLConnection connectionWithRequest:req
delegate:self];
[conn start];
}
- (NSURLRequest *)connection:(NSURLConnection *)connection
willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse
*)redirectResponse {
NSLog(@"Starting: %@", request);
return request;
}
- (void)application:(UIApplication *)application
didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
NSLog(@"Device registration with APNS failed with Error: %@", error);
}
Farrukh
On 2011-06-29, at 8:36 PM, Jesse Tayler wrote:
> I'm missing just a little something --
>
> I'm able to send apns running my wo-app in eclipse - I now send without
> returning an error at least.
>
> String payload = APNS.newPayload().alertBody("Alert!").build();
> String token = "3a09e272 3668c411 .....";
> service.push(token, payload);
>
> I got my device token string from the return value on the ios device - so it
> seems my device has properly registered - yes?
>
> - (void)application:(UIApplication *)application
> didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
>
> The token string I'm sending from WO is the token string returned in my iOS
> device but still no notification gets received?
>
> Something I've missed or should check?
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]