在我的应用程序中,我通过将设备 ID 存储在服务器中并使用 php 我发送通知来添加通知,问题是现在设备令牌没有存储在服务器中,以前它可以工作 f9 但不是它不工作。
以前我使用不同的帐户现在我在我的应用程序中设置新帐户认证后访问不同的帐户不起作用请告诉我哪里错了。
通知代码。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeNone)];
return YES;
}
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
const char* data = [deviceToken bytes];
NSMutableString * token = [NSMutableString string];
for (int i = 0; i < [deviceToken length]; i++) {
[token appendFormat:@"%02.2hhX", data[i]];
}
NSString *urlString = [NSString stringWithFormat:@"url?token=%@",token];
NSURL *url = [[NSURL alloc] initWithString:urlString];
NSLog(@"token %@",urlString);
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSLog(@"request %@ ",urlRequest);
NSData *urlData;
NSURLResponse *response;
urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:nil];
NSLog(@"data %@",urlData);
[self clearNotifications];
}
上面相同的代码以前工作正常,现在它不工作我无法找到解决方案,为什么在我更改为新帐户后它不存储请告诉我如何解决。
谢谢。