繁体   English   中英

在iOS上推送通知

[英]Push Notifications on iOS

我按照本教程在我的iOS应用程序中实现推送Apple推送通知服务教程

我按照说明做了所有事情,推送通知效果很好。 但是,我没有在设置菜单中看到我的应用程序,所以我可以禁用推送通知,如果我喜欢。

我添加到我的代码中的是:

在delegate.m文件中:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

    // Let the device know we want to receive push notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
        (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

    return YES;
}

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    NSLog(@"My token is: %@", deviceToken);
}

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    NSLog(@"Failed to get token, error: %@", error);
}

我想要的就是能够禁用推送通知。 该教程指出我应该使用上面的代码选项,但我没有看到任何东西。

你在正确的地方检查? 正确的位置在设置 - >通知下。 除非您实际配置了设置,否则应用程序不会直接显示在“设置”列表中(即使确实如此,也不会显示通知设置)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM