Это мой класс AppDelegate.В моем приложении я использую сервис Apple Push Notification.Я получаю Push-уведомление.
Но проблема в том, что когда я нажимаю кнопку «Просмотр» в уведомлении о push-уведомлении, мое приложение не загружается.
В любом случае я просто хочучтобы показать / загрузить мое приложение, когда пользователь нажимает кнопку «Просмотр» в уведомлении о push-уведомлении.
Какая ошибка в моем коде и какой еще код я должен написать.Пожалуйста, помогите мне.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
CGRect frame = [UIScreen mainScreen].bounds;
window = [[UIWindow alloc] initWithFrame:frame];
window.backgroundColor = [UIColor blackColor];
[window makeKeyAndVisible];
splashScreen = [[SplashViewController alloc] initWithImage:[UIImage imageNamed:@"Screen.png"]];
navigationController = [[UINavigationController alloc] initWithRootViewController:splashScreen];
[window addSubview:navigationController.view];
NSLog(@"Registering for push notifications...");
[[UIApplication sharedApplication]registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert |UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound)];
return YES;
}
- (void)application:(UIApplication *)app
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSString *str =
[NSString stringWithFormat:@"Device Token=%@",deviceToken];
NSLog(@"%@", str);
}
- (void)application:(UIApplication *)app
didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
{
NSString *str = [NSString stringWithFormat: @"Error: %@", err];
NSLog(@"%@", str);
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
{
for (id key in userInfo) {
NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
}
}