BT

Building iOS 8 Share Extensions: A GitHub Repo with Issues, Sample Code, and Workarounds

| by Sergio De Simone Follow 14 Followers on Sep 26, 2014. Estimated reading time: 2 minutes |

Share extensions, introduced by Apple in iOS 8, "provide an exciting opportunity for developers of all types of apps to integrate with their customers’ devices like never before," says Bryan Irace, iOS developer at Tumblr. Though, as it is often the case with new technologies, the road to building iOS share extensions is paved not only with fun but also with frustration.

Indeed, as Bryan recounts his experience creating Tumblr app share extension, "we have hit quite a few problems that we ended up needing to work around." Found problems range from what might appear as legitimate bugs waiting to be fixed to utter limitations of current iOS 8 extensions architecture. Here is a short review of all issues Bryan reported.

  • Background file upload does not work

    Although, according to Apple documentation, an extension should be allowed to upload a file hosted in the container shared with the container app through NSURLSessionUploadTask, the engineers at Tumblr have not found a way to get this to actually work, since it seems that, as soon as the share extension is dismissed, the background upload stops.

  • The container app must be opened before the share extension can be effectively used

    This problem only actually affects app updates that install new extensions: the app data already exists somewhere outside of the shared container, and only the container app can migrate it over on its first launch. If that step is not done before using the share extension, it is likely that the user will not be able to accomplish what he is up to, since the extension will not know nothing about the user data (user defaults, keychains, databases, files serialized via NSCoding, etc.)

  • NSFileCoordinator seemingly does not work

    As described in WWDC Session 217, NSFileCoordinator is supposed to be an alternative to NSUserDefaults and SQLite for custom data persistence between an extension and its container app.

  • Share extensions can’t set the status bar color

    A share extension is always displayed with the status bar style of the host application. This could lead to visual color clashes and has no workaround.

  • You can’t exclude your own share extension from your application’s activity controllers

    This is just a glitch affecting apps that provide a share extension to be used from other apps while also providing a custom share functionality. In this case, it might be desirable to exclude the share extension from its container app's activity controller, but it is not possible.

  • Share extensions will only show up if they explicitly support all of the provided activity items

    This is, according to Bryan, the most important issue they have found. To understand it, say you create a share extension that supports either image data or URLs or text. Well, such an extension will only be shown in host apps that explicitly support images and URLs and text.

As Bryan points out, not every developer building a share extension is bound to meet those same limitations, still in the interest of helping other developers, he set up a github page detailing all the issues they have found, including sample code, Radar issues, and workarounds where available. Any developers finding new limitations or workarounds to already known limitations can issue a pull request.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT