Tsay
Tsay

Reputation: 57

iOS Share Extension interacting with another app

I created a iOS Share Extension, the purpose of this share extension is to send the shared content to a third party device. In order to connect with this device, I'm usisng their SDK and this SDK is relies on their own iOS app to select the device.

Let's forget about share extension for a second. Imagine that I open my app and I have a button, when I click it sends a predefined text to the third party device. When I press this button, the SDK will open their iOS app, will let me select my device from a list, and will call my app again using the url schema, sharing the specific hardware details. So, to discover the device, the SDK needs to open their own app, then back into my app I will use the device details to send the message through the SDK.

Now, coming back to the share extension. The thing is, that I don't know the right way to do this with the share extension. If I try to call their SDK to discover the devices from the extension, instead of opening their app, the extension crashes with the following error: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread. but anyway, probably this is not the right way to do it.

Maybe the easiest way is to open my app from the share extension and handle everything from it, but I've been reading and looks like opening the main app from the share extension is not a good practice, so I'm a bit stuck on this.

Upvotes: 0

Views: 242

Answers (1)

Dzmitry Sotnikov
Dzmitry Sotnikov

Reputation: 80

Extensions have a lot of different limitations compared to a regular app. Including in iOS, there is NO WAY AT ALL to open another app from an extension. You can only save some data in the group storage for later use.

Upvotes: 0

Related Questions