在应用程序内启用或禁用Iphone推送通知 [英] Enable or Disable Iphone Push Notifications inside the app

查看:117
本文介绍了在应用程序内启用或禁用Iphone推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iphone应用程序,可以接收推送通知。目前我可以通过转到iphone设置/通知来禁用我的应用程序的推送通知。

I have a iphone app which is enable to receive push notifications. Currently i can disable push notifications for my app by going to the iphone settings/Notifications.

但我想在我的应用程序中添加一个开关或按钮来启用或禁用推送通知。

But i want to add a switch or button inside my app to enable or disable push notifications.

可以这样做,因为我在foursqure iphone应用程序中看到了它。他们在设置呼叫通知设置中有一个部分,用户可以启用或禁用该应用的不同类型的通知。

It can be done because i saw it in foursqure iphone app did it. They got a section in settings call notification settings and user can enable or disable different kind of notification for the app.

我在网上查找找到适当的解决方案这但仍未找到方法。任何人都可以知道如何做到这一点?

I look all over the net to find a proper solution for this but still not found a way. Can any one please give any idea how to do that ?

提前致谢:)

推荐答案

首先,你是无法在应用内启用和禁用 推送通知。如果你找到一些应用程序,它必须有解决方案解决方案。

First thing is that you can not enable and disable push notification in inside the app. If you have found some apps which did it than there must be workaround solution.

如果你想在应用内部做,然后使用一个标识符并将其发送到服务器根据推送通知启用和禁用按钮。因此,您的服务器端编码使用此标识符并根据该标识符工作。就像标识符一样,它是启用的,而不是你的服务器会发送通知,否则不会。

Like if you want to do Inside the app then use one identifier and send it to server according push notification enable and disable button. So, your server side coding use this identifier and work according to that. Like identifier is say it's enable than your server will send notification otherwise not.

你可以检查用户设置启用使用以下代码禁用 推送通知

You can check that user set enable or disable Push Notifications using following code.

启用或禁用Iphone推送通知

Enable or Disable Iphone Push Notifications

UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types == UIRemoteNotificationTypeNone) 
 // Yes it is..

希望,这会对你有帮助..

Hope, this will help you..

这篇关于在应用程序内启用或禁用Iphone推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆