【发布时间】:2016-08-19 13:08:35
【问题描述】:
我已经使用Urban Airship 设置了我的目标 C 应用程序以接收推送通知,并且可以很好地接收它们。但在我的应用程序中,用户应该能够删除这些通知,即用户不想再收到任何推送消息。我只是不知道如何关闭它。
我知道用户可以在设备设置中禁用应用程序设置中的通知,但在这种特殊情况下,这不是一个理想的解决方案。该应用仍应允许接收通知。
我找到了一些要调用的方法和要设置的变量,但没有任何帮助。当我尝试删除我的注册以获取通知时,我称之为:
[UAirship push].allowUnregisteringUserNotificationTypes = YES;
[UAirship push].userPushNotificationsEnabled = NO;
[UAirship push].backgroundPushNotificationsEnabled = NO;
[[UAirship push] setUserNotificationTypes:(UIUserNotificationTypeNone)];
[[UAirship push] updateRegistration];
任何人都知道这实际上是可能的,还是我必须以不同的方式删除?
【问题讨论】:
-
您是否使用第三方框架来停止通知..
UAirship是什么? -
@vaibhav 我正在使用名为 Urban Airship 的第三方框架来处理推送通知,而不是 Apple 的 APNS 服务器。所以我设置了 Urban Airship,以便能够通过他们的服务器向我的应用程序发送推送通知。但我无法关闭它,即使上面显示的代码表明它应该是可能的。
-
@ClookWise 我在这里的困惑会感染所有第三方推送通知,例如
GCM或UAirship与 APN 同步,所以您是否尝试过禁用常规方式 (APN) 的通知..
标签: ios objective-c apple-push-notifications urbanairship.com