在两个或多个 iPhone 应用程序之间共享数据 [英] Share data between two or more iPhone applications

查看:34
本文介绍了在两个或多个 iPhone 应用程序之间共享数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是否可以在同一设备上的两个应用程序之间共享数据?

Is this possible to share data between two applications on the same device?

或者我可以允许其他应用程序使用我应用程序的信息/数据或以任何其他方式吗?

Or can I allow some other application to use my application's information / data or in any other way?

例如,第一个应用程序是用于事件管理,我用它来保存一些事件.第二个应用程序是提醒,它会从另一个应用程序中获取数据,以提醒我有关该事件的信息.

For example, the first application is for event management, and I use it to save some event. The second application is for reminders, which will get data from the other application in order to remind me about the event.

这只是一个简单的例子,不是真实的场景.

This is just a simple example, not a real scenario.

推荐答案

从历史上看,iPhone 一直试图阻止应用程序之间的数据共享.这个想法是,如果你无法获取另一个应用的数据,你就不能对该应用做任何坏事.

Historically, the iPhone has tried to prevent data sharing between apps. The idea was that if you couldn't get at another app's data, you couldn't do anything bad to that app.

在最近的 IOS 版本中,他们放宽了一点.例如,iOS 编程指南现在有一节介绍通过让一个应用声明某个 URL 前缀,然后让其他应用引用该 URL 来在应用之间传递数据.因此,也许您将事件应用设置为回答event://"URL,就像网络服务器回答http://"URL 一样.

In recent releases of IOS, they've loosened that up a bit. For example, the iOS programming guide now has a section on passing data between apps by having one app claim a certain URL prefix, and then having other apps reference that URL. So, perhaps you set your event app to answer "event://" URLs the same way that a webserver answers for "http://" URLs.

Apple 对这种方法的文档是 此处.

Apple's documentation of that approach is here.

查看实施自定义 URL 方案".

Have a peek under "Implementing Custom URL Schemes".

这篇关于在两个或多个 iPhone 应用程序之间共享数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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