如何以编程方式在 iOS 上添加日历订阅? [英] How to programmatically add calendar subscriptions on iOS?

查看:28
本文介绍了如何以编程方式在 iOS 上添加日历订阅?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过 iPhone 的设置面板,您可以添加对远程 .ics 日历格式的订阅.我有 一个荷兰 iPhone 应用,它可以在应用内执行此操作(请参见下面的屏幕截图,abonneren op de议程"的意思是订阅日历"),但也必须有其他人.

Via the settings panel of your iPhone, you can add a subscription to a remote .ics calendar format. I have a Dutch iPhone app that does this from within the app (see the screenshot below, "abonneren op de agenda" means "subscribe to the calendar"), but there must be others too.

我想为我的一个项目模仿这种行为,但我找不到用于执行此操作的 API.看起来它不是 EventKit 的一部分,但是因为在示例应用程序中点击订阅"时没有应用程序切换,我怀疑它也不是 url 方案.

I want to mimic this behavior for a project of mine, but I can't find the API to do this with. It looks like it's not a part of EventKit, but because there's no app switching going on when you hit 'subscribe' in the example app I suspect it's also not a url scheme.

谁知道?

推荐答案

试试这样的:

NSString *url = @"http://server/filename.ics";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

如果用户想订阅,这会向用户显示带有问题的 uialertview.

This shows an uialertview with the question to the user if he/she wants to subscribe.

;)

这篇关于如何以编程方式在 iOS 上添加日历订阅?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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