Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sharing a link opened in safari in ios to my application?

I need help about this problem.

I have a functionality in my application to share links with other users, what I need to do is:

  1. Open any link in safari browser
  2. Directly some action on safari browser to share that link in my application.

Is this possible in iOS to share a link from browser to the app directly.

Need help about this.

Regards.

like image 487
Badr Avatar asked Sep 07 '25 11:09

Badr


1 Answers

Starting from iOS 8 Using Share App Extension can achieve this task

I managed to do it by creating a Share extension app (File->New->Target->Application Extension)

enter image description here

Then from Targets->Info I specified support for web URLs

enter image description here

Then i spent time searching for a way to use original app files in the app extension and this post helped me a lot Sharing code between original iOS App and App Extension

If you are using cocoapods this can help you too https://stackoverflow.com/a/31989172/3033056 but be aware that not all pods are allowed to be used in app extensions

This is a link for a tutorial http://www.appcoda.com/ios8-share-extension-swift/

like image 60
Mohamed Elkassas Avatar answered Sep 10 '25 01:09

Mohamed Elkassas