iOS NSData在发送PNS设备令牌时记录空值

时间:2012-11-03 06:51:07

标签: ios push-notification nsdata apple-push-notifications

我正在为我的应用程序启用PNS服务...当我尝试记录我的NSData值时,我将其发送到我的服务器,它记录为null。如果我在我的VC中使用相同的代码进行ibaction,它工作正常,如果我手动输入设备令牌..这是我的代码......有什么想法来解决我的问题吗?...

NSString* newToken = [deviceToken description];
newToken = [newToken stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
newToken = [newToken stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString *urlString = [NSString stringWithFormat:@"http://sample.net/demo/registerDevice.php?appId=0003&deviceToken=%@",newToken];
NSLog(@"%@",newToken);
NSURL *url = [[NSURL alloc] initWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
 NSData *urlData ;
NSURLResponse *response ;
urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:nil];
NSLog(@"%@",urlData); 

0 个答案:

没有答案