我正在为我的应用程序启用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);