使用未包含在我的应用程序中的数据文件

Using data files not incorporated inside my app

我有一个 API 我构建了它并将其转换为 CoCa 框架 (iOS 8) 我的 API 引擎正在使用一些大数据文件。 (~100MB)

我的问题是引擎是可选的。我的最终用户可能想要也可能不想拥有该功能。所以,我不想将这些文件包含在我的库(框架)中。我希望能够根据用户请求下载它,然后使用它。

将此框架(和应用程序)制作成正常大小的 BKM 是什么,然后仅应用户要求下载 100MB?

无论我走到哪里,似乎都在谈论静态库以及如何将所有内容提前包含在应用程序包中。

有哪些替代方案?

对不起,如果我错过了显而易见的...

如果您的数据文件不包含可执行代码,您可以将它们存储在别处。如果是内购内容,可以将这些文件存放在苹果服务器上。

来自In-App Purchase Programming Guide

If the product has associated content, your app needs to deliver that content to the user. For example, purchasing a level in a game requires delivering the files that define that level, and purchasing additional instruments in a music app requires delivering the sound files needed to let the user play those instruments.

You can embed that content in your app’s bundle or you can download it as needed—each approach has its advantages and disadvantages. If you include too little content in your app bundle, the user must wait for even small purchases to be downloaded. If you include too much in your app bundle, the initial download of the app takes too long, and the space is wasted for users who don’t purchase the corresponding products. Additionally, if your app is too large, users won’t be able to download it over cellular networks.

Embed smaller files (up to a few megabytes) in your app, especially if you expect most users to buy that product. Content in your app bundle can be made available immediately when the user purchases it. However, to add or update content in your app bundle, you have to submit an updated version of your app.

Download larger files when needed. Separating content from your app bundle keeps your app’s initial download small. For example, a game can include the first level in its app bundle and let users download the rest of the levels when they’re purchased. Assuming your app fetches its list of product identifiers from your server, and not hard-coded in the app bundle, you don’t need to resubmit your app to add or update content that is downloaded by your app.

In iOS 6 and later, most apps should use Apple-hosted content for downloaded files. You create an Apple-hosted content bundle using the In-App Purchase Content target in Xcode and submit it to iTunes Connect. When you host content on Apple’s servers you don’t need to provide any servers—your app’s content is stored by Apple using the same infrastructure that supports other large-scale operations, such as the App Store. Additionally, Apple-hosted content automatically downloads in the background even if your app isn’t running.

You might choose to host your own content if you already have server infrastructure, if you need to support older versions of iOS, or if you share your server infrastructure across multiple platforms.