简体   繁体   中英

Best way to transfer large data between iPhone and iPad apps

I'm looking at different ways of transferring data between iOS apps, for instance UrlScheme, Shared Keychain, UIActivity, Custom Url etc..

However I would like to knnow what's the best way of passing large amounts of data between apps, such as 1 or 2 photos, as well as some standard text data. iCloud is not available.

Can anyone provide advice on which one is the best of these methods for this task given that the data can be quite large?

Presumably you already found this link - the 4th answer sums up pros/cons of the options you asked about: Share data between two or more iPhone applications

The first thing that came to mind for me was adding "Open In {Some Other App]" functionality, since that's pretty much the standard interaction users have come to expect since iOS6. Whether or not that's "best" I suppose depends on what you want to do w/the data/images in the 2nd app...

The 1st/"sending" app subclasses and manages UIActivityViewController. This is where you customize the options you want to make available (like "Open in 2nd App", "Print", etc). You use a UIActivityItemProvider subclass to wrap the data you want to send. This conforms to the UIActivityItemSource protocol to handle callbacks, etc. You can create a custom file type, or use a common one the 2nd app supports.

The receiving app registers a supported file type w/the system. This can be a custom type/extension you define, or it could be a common format like JPG, PNG, etc, as long as you actually send that type and the receiving app tells the system it handles that type of file.

"Absolute Ripple" has an in-depth 3-part tutorial about the process to customize wrapping & sending data via UIActivityViewController to another app (social media & mail in this case): http://www.absoluteripple.com/1/post/2013/06/customising-activity-view-controller-mail.html

"The Other Steve Smith" in this blogpost does a quick rundown of creating/registering a custom Uniform Type Identifier or file type, along w/a custom graphic for your target app. http://stevenpsmith.wordpress.com/2013/03/11/using-custom-file-types-to-import-data-into-your-ios-apps/

Maybe not at all what you're looking for, but if so I hope that helps

If you need to transfer only Photos, you can use Camera roll.

  1. Save image to Camera Roll using ALAssetsLibrary which will provide assetURL in completionBlock.
  2. Transfer image assetURL to second app ( with lunchOptions for example )
  3. Load image in second app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM