从iOS上的两个不同应用访问相同的文件 [英] Access to same files from two different apps on iOS

查看:210
本文介绍了从iOS上的两个不同应用访问相同的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发两个应用程序, App1 ,它将文件从Dropbox下载到iPad, App2 。 Dropbox集成有点麻烦,我宁愿不在两个应用程序上都这样做。那么可以从 App1 保存那些 App2 可能访问它们的文件吗?我听说应用程序的沙盒在iOS6中有点宽松,但不确定如何松散。

I have two apps I'm developing at the moment, App1, which is downloading files from Dropbox to the iPad, and App2. The Dropbox integration is a bit of a hassle, and I'd rather not do it on both apps. So is it possible to save those files from App1 somewhere that App2 might access them? I've heard that the Sandboxing of apps got a bit looser in iOS6, but not really sure how loose.

我见过一些类似的问题在这里,但它们似乎通过使用URL方案或将数据发送到其他应用程序来解决,这不是我真正想要的。

I've seen some similar questions here, but they seem to be solved by using URL schemes or sending data to the other app, which isn't really what I'm after.

任何其他我们将不胜感激。

Any other ideas to solve this will be appreciated.

推荐答案

这是可能的,但本地方法并不适合大文件。

This is possible, but the local method isn't really suitable for large files.

您可以使用钥匙串存储少量数据,类似于NSUserDefaults。优点是可以在应用程序之间共享。请参阅 http://shaune.com.au/ios-keychain-sharing-data-between -apps /

You can use the Keychain to store small amounts of data, similar to NSUserDefaults. The advantage is this can be shared between applications. Refer to http://shaune.com.au/ios-keychain-sharing-data-between-apps/

至于你想要共享文件的情况,可以将它们编码为字符串和存储在钥匙串中(在我看来是非常糟糕的主意),或者使用网络服务(如果您的目标是iOS 5及更高版本,只要您拥有相同的团队ID,iCloud应该可以使用两个应用程序)。请参阅 http://developer.apple.com/library/ios /#documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AboutEntitlements.html

As for your case, where you want to share files, you could encode them to a string and store in the keychain (in my opinion a very bad idea), or use a web service (if you're targeting iOS 5 and above, iCloud should do the trick as long as you have the same Team ID for both apps). Refer to http://developer.apple.com/library/ios/#documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AboutEntitlements.html

我更喜欢网络服务,iCloud应该让这更容易你。

I'd prefer the web service, iCloud should make this a lot easier for you.

这篇关于从iOS上的两个不同应用访问相同的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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