iOS Apple 推送通知服务警报框

发布于 2024-12-06 00:38:35 字数 204 浏览 1 评论 0原文

我是 iOS 的 APNS 新手,实际上也是 iOS 开发新手。

我在 Easy APNS 的帮助下成功实现了 APNS ..但是当涉及到警报框时,我想要以下功能

一旦用户单击警报框上的“查看”按钮,我希望加载应用程序,然后重定向到 URL通过警报框消息。

任何人都可以给我一些关于同样的想法..

谢谢和问候 任何帮助都会非常感激

i am new to APNS of iOS infact new to iOS development too.

I was successful on Implementing APNS with the help of Easy APNS.. but when it comes to Alert Box i want the below functionality

Once the user clicks on View Button on the Alert Box i want the Application to Load and then the redirected to the URL Passed though the Alert Box Msg.

Can Any one give me some idea about the same ..

Thanks and regards
Any help would be high Appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

潜移默化 2024-12-13 00:38:35

在实现 UIApplicationDelegate 的对象中实现方法:

当正在运行的应用程序收到远程通知时发送到委托:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo;

并且

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

您应该检查:

NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (userInfo != nil)

然后当满足所有条件时,您可以从 userInfo 字典中获取推送通知的 alert 属性的值:

userInfo 字典包含另一个可以使用 aps 键获取的字典。您可以使用以下键访问 aps 字典的内容(尽管在大多数情况下不需要这样做):....

我不想复制+粘贴所有 Apple 文档,只需在此处阅读有关此内容的更多信息: UIApplicationDelegate 协议参考

当您获得 url 的值时,您可以打开它,例如,以这种方式:

[[UIApplication sharedApplication] openURL:[request URL]];

或使用 UIWebView 类参考 创建您自己的迷你互联网浏览器来查看 url 的内容。

In your object that implements UIApplicationDelegate implement method:

Sent to the delegate when a running application receives a remote notification:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo;

And in

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

you should check if:

NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (userInfo != nil)

Then when all conditions are met you could get value of your alert property of push-notification from userInfo dictionary:

The userInfo dictionary contains another dictionary that you can obtain using the aps key. You can access the contents of the aps dictionary—though you shouldn’t need to in most cases—using the following keys:....

I don't want to copy+paste all Apple docs, just read more about this here: UIApplicationDelegate Protocol Reference

When you will have the value of url you can open it, for example, in such manner:

[[UIApplication sharedApplication] openURL:[request URL]];

Or using UIWebView Class Reference create your own mini-internet browser to view contents of the url.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文