
This will allow access to a shared container between the extension and container app. In order for an extension to share data with its container app, you need to configure an App Group. You need a developer account to enable App Groups. First, you’ll need a Client ID from Imgur to use their API and second, you’ll need to set up an App Group. There are a couple things you need to do to get it running. With the app overview out of the way, we can now set it up.

To make things simple we’ll use Imgur for this as it allows users to upload images anonymously (without the images being linked to an account). We are going to build a Share extension that shares photos to a social networking site. Any custom application that presents an instance of the UIActivityViewController class will be able to see your sharing extension if you built your extension so that it can handle the file type provided by that application. This isn’t limited to system applications. With share extensions, users will now be able to share content to your service direct from within the app they are using, be it Safari, Photos or other apps. Previously, sharing content usually entailed switching from one app to another, for example, while surfing in Safari, if you wanted to share a URL, you would copy it, switch to the app you wanted to save or share it in, perform the action and then resume surfing in Safari. Share extensions, introduced in iOS 8, give users an easy and convenient way to share content with other entities, such as social sharing websites or upload services. Requestb.IOS Building a Simple Share Extension in iOS 8 App Share the Extension logic Fill in the logic limiting the word lengthįirst we fill in a few things that limit the number of words that can be entered in the Share Extension, and then add a Share path In fact, this table can be found in the official website documentation ~~

Text sharing is not supported by default, for example NSExtensionActivationSupportsVideoWithMaxCount NSExtensionActivationSupportsImageWithMaxCount Web page sharing is not supported by default, for example

NSExtensionActivationSupportsWebPageWithMaxCount No more than 20 for single or multiple choices NSExtensionActivationSupportsFileWithMaxCount Sharing hyperlinks is not supported by default, such as NSExtensionActivationSupportsWebURLWithMaxCount NSExtensionActivationSupportsAttachmentsWithMinCountĪttachment maximum limit: default=1 when the above is not zeroīy default, at least one attachment is selected and the Extension icon is displayed in The attachment includes the following three categories of File, Image and Movie, and the total amount of single and mixed selection does not exceed 20 NSExtensionActivationSupportsAttachmentsWithMaxCount Now that we know the methods above, let's configure the content rules we can deliver, which are IOS extensions support media type keys
Didselectpost swift share extension code#
( IBAction)ShareAction:( UIButton *)sender Copy the code I used the StoryBoard for convenience.ĭrag a UIButton to the StoryBoard, rename it Share, and associate the Action event with the ViewController, adding the corresponding code. Now that the new project and Share Extension have been created, we can call the Share Extension in the main application to see the effect. Just like Today Extension, the system has its own template for us to choose from The new project here is called ShareExtensionDemo.Īfter creating the new project, we will now create the Share Extension. Since ShareExtension is not an independent application, it depends on the main program, so I have omitted the order of creating the new project. Therefore, Share Extension is actually the system's own social SDKįirst of all, we need to create a new project. The iCon column in the middle is the system's own Share Extension(as shown in the picture), which is to Share Safari's website address. You can open Safari, select a website, click On Share, and a sharing interface will appear. What is a Share Extension? In iOS 8, Apple introduced several new features, one of which is Share Extension. When contacting me, please note the Share Extension

I will refer to your comments and then modify it. Now I finally have time to study itįinally: If you have better suggestions or dissatisfaction with this article, please contact me. Due to my busy work, I have been putting it off, so I did not continue to study it. Enter the logic for uploading informationĪ few days ago I wrote another post about the new features of iOS 8 called Playing with iOS Development: The introduction of Today Extension, a new feature of iOS 8, is one of the features of iOS 8.Fill in the logic limiting the word length.
