Swift: how to add App sharing feature with Extension Sheet





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I want to add the my app sharing feature in my App. Like The Action Sheet Toggle up with the all the social Media and other app in which i can share my app Url. I try to find the tutorial for that but i can't find the proper tutorial for that. this is what I have Done.



func shareApp (){
let textToShare = "Swift is awesome! Check out this website about it!"

if let myWebsite = NSURL(string: "http://www.google.com/") {
let objectsToShare = [textToShare, myWebsite] as [Any]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)

activityVC.excludedActivityTypes = [UIActivityType.airDrop, UIActivityType.addToReadingList]

self.present(activityVC, animated: true, completion: nil)
}


This What i Get.



enter image description here



So just want to show there Some Social Media options There.










share|improve this question


















  • 1





    You need to run the app on an actual device with a couple of installed apps. (e.g. WhatsApp, Telegram, Facebook)

    – iVarun
    Jan 3 at 5:17











  • so my code is perfect you mean that.

    – Krunal Nagvadia
    Jan 3 at 5:18











  • Yes, It looks good as you are also able to see UIActivityViewController. You just need to change URL to actual app URL that you want to share.

    – iVarun
    Jan 3 at 5:20













  • ok. i have to setup any permission for that in plist?

    – Krunal Nagvadia
    Jan 3 at 5:21











  • You don't need to set any permissions.

    – iVarun
    Jan 3 at 5:39


















0















I want to add the my app sharing feature in my App. Like The Action Sheet Toggle up with the all the social Media and other app in which i can share my app Url. I try to find the tutorial for that but i can't find the proper tutorial for that. this is what I have Done.



func shareApp (){
let textToShare = "Swift is awesome! Check out this website about it!"

if let myWebsite = NSURL(string: "http://www.google.com/") {
let objectsToShare = [textToShare, myWebsite] as [Any]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)

activityVC.excludedActivityTypes = [UIActivityType.airDrop, UIActivityType.addToReadingList]

self.present(activityVC, animated: true, completion: nil)
}


This What i Get.



enter image description here



So just want to show there Some Social Media options There.










share|improve this question


















  • 1





    You need to run the app on an actual device with a couple of installed apps. (e.g. WhatsApp, Telegram, Facebook)

    – iVarun
    Jan 3 at 5:17











  • so my code is perfect you mean that.

    – Krunal Nagvadia
    Jan 3 at 5:18











  • Yes, It looks good as you are also able to see UIActivityViewController. You just need to change URL to actual app URL that you want to share.

    – iVarun
    Jan 3 at 5:20













  • ok. i have to setup any permission for that in plist?

    – Krunal Nagvadia
    Jan 3 at 5:21











  • You don't need to set any permissions.

    – iVarun
    Jan 3 at 5:39














0












0








0








I want to add the my app sharing feature in my App. Like The Action Sheet Toggle up with the all the social Media and other app in which i can share my app Url. I try to find the tutorial for that but i can't find the proper tutorial for that. this is what I have Done.



func shareApp (){
let textToShare = "Swift is awesome! Check out this website about it!"

if let myWebsite = NSURL(string: "http://www.google.com/") {
let objectsToShare = [textToShare, myWebsite] as [Any]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)

activityVC.excludedActivityTypes = [UIActivityType.airDrop, UIActivityType.addToReadingList]

self.present(activityVC, animated: true, completion: nil)
}


This What i Get.



enter image description here



So just want to show there Some Social Media options There.










share|improve this question














I want to add the my app sharing feature in my App. Like The Action Sheet Toggle up with the all the social Media and other app in which i can share my app Url. I try to find the tutorial for that but i can't find the proper tutorial for that. this is what I have Done.



func shareApp (){
let textToShare = "Swift is awesome! Check out this website about it!"

if let myWebsite = NSURL(string: "http://www.google.com/") {
let objectsToShare = [textToShare, myWebsite] as [Any]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)

activityVC.excludedActivityTypes = [UIActivityType.airDrop, UIActivityType.addToReadingList]

self.present(activityVC, animated: true, completion: nil)
}


This What i Get.



enter image description here



So just want to show there Some Social Media options There.







ios swift xcode ios8-share-extension






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 at 5:10









Krunal NagvadiaKrunal Nagvadia

15114




15114








  • 1





    You need to run the app on an actual device with a couple of installed apps. (e.g. WhatsApp, Telegram, Facebook)

    – iVarun
    Jan 3 at 5:17











  • so my code is perfect you mean that.

    – Krunal Nagvadia
    Jan 3 at 5:18











  • Yes, It looks good as you are also able to see UIActivityViewController. You just need to change URL to actual app URL that you want to share.

    – iVarun
    Jan 3 at 5:20













  • ok. i have to setup any permission for that in plist?

    – Krunal Nagvadia
    Jan 3 at 5:21











  • You don't need to set any permissions.

    – iVarun
    Jan 3 at 5:39














  • 1





    You need to run the app on an actual device with a couple of installed apps. (e.g. WhatsApp, Telegram, Facebook)

    – iVarun
    Jan 3 at 5:17











  • so my code is perfect you mean that.

    – Krunal Nagvadia
    Jan 3 at 5:18











  • Yes, It looks good as you are also able to see UIActivityViewController. You just need to change URL to actual app URL that you want to share.

    – iVarun
    Jan 3 at 5:20













  • ok. i have to setup any permission for that in plist?

    – Krunal Nagvadia
    Jan 3 at 5:21











  • You don't need to set any permissions.

    – iVarun
    Jan 3 at 5:39








1




1





You need to run the app on an actual device with a couple of installed apps. (e.g. WhatsApp, Telegram, Facebook)

– iVarun
Jan 3 at 5:17





You need to run the app on an actual device with a couple of installed apps. (e.g. WhatsApp, Telegram, Facebook)

– iVarun
Jan 3 at 5:17













so my code is perfect you mean that.

– Krunal Nagvadia
Jan 3 at 5:18





so my code is perfect you mean that.

– Krunal Nagvadia
Jan 3 at 5:18













Yes, It looks good as you are also able to see UIActivityViewController. You just need to change URL to actual app URL that you want to share.

– iVarun
Jan 3 at 5:20







Yes, It looks good as you are also able to see UIActivityViewController. You just need to change URL to actual app URL that you want to share.

– iVarun
Jan 3 at 5:20















ok. i have to setup any permission for that in plist?

– Krunal Nagvadia
Jan 3 at 5:21





ok. i have to setup any permission for that in plist?

– Krunal Nagvadia
Jan 3 at 5:21













You don't need to set any permissions.

– iVarun
Jan 3 at 5:39





You don't need to set any permissions.

– iVarun
Jan 3 at 5:39












2 Answers
2






active

oldest

votes


















1














All you have done is right, except you have not added the App url of your appstore link. Add that link like https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8 and all your media will be appear in list if those application is installed in iphone.






share|improve this answer
























  • ok so my code is perfect? Or need any implement? And i have to give any permission in info.plist or any other procedure to follow? Please explain in brief.

    – Krunal Nagvadia
    Jan 3 at 5:20











  • Check I have shared a code with you below in answer, This shares my App with link to all application which has sharing feature. like mail, facebook. but those application will appear in UIActivityViewController if those application installed in iPhone. in simulator you won't get application try it in real device which has facebook and mail application installed

    – Paresh. P
    Jan 3 at 5:40



















0














You have got UIActivityViewController presented now, Just add in text like,



func ShareApp()
{
let items:[Any] = ["Marketplace of Building Material for Architects, Interior Designers, Contractors and Home Owners. Find Material for your next project. Download https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8"]
let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
self.present(ac, animated: true)

}





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016663%2fswift-how-to-add-app-sharing-feature-with-extension-sheet%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    All you have done is right, except you have not added the App url of your appstore link. Add that link like https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8 and all your media will be appear in list if those application is installed in iphone.






    share|improve this answer
























    • ok so my code is perfect? Or need any implement? And i have to give any permission in info.plist or any other procedure to follow? Please explain in brief.

      – Krunal Nagvadia
      Jan 3 at 5:20











    • Check I have shared a code with you below in answer, This shares my App with link to all application which has sharing feature. like mail, facebook. but those application will appear in UIActivityViewController if those application installed in iPhone. in simulator you won't get application try it in real device which has facebook and mail application installed

      – Paresh. P
      Jan 3 at 5:40
















    1














    All you have done is right, except you have not added the App url of your appstore link. Add that link like https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8 and all your media will be appear in list if those application is installed in iphone.






    share|improve this answer
























    • ok so my code is perfect? Or need any implement? And i have to give any permission in info.plist or any other procedure to follow? Please explain in brief.

      – Krunal Nagvadia
      Jan 3 at 5:20











    • Check I have shared a code with you below in answer, This shares my App with link to all application which has sharing feature. like mail, facebook. but those application will appear in UIActivityViewController if those application installed in iPhone. in simulator you won't get application try it in real device which has facebook and mail application installed

      – Paresh. P
      Jan 3 at 5:40














    1












    1








    1







    All you have done is right, except you have not added the App url of your appstore link. Add that link like https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8 and all your media will be appear in list if those application is installed in iphone.






    share|improve this answer













    All you have done is right, except you have not added the App url of your appstore link. Add that link like https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8 and all your media will be appear in list if those application is installed in iphone.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 3 at 5:17









    Paresh. PParesh. P

    6118




    6118













    • ok so my code is perfect? Or need any implement? And i have to give any permission in info.plist or any other procedure to follow? Please explain in brief.

      – Krunal Nagvadia
      Jan 3 at 5:20











    • Check I have shared a code with you below in answer, This shares my App with link to all application which has sharing feature. like mail, facebook. but those application will appear in UIActivityViewController if those application installed in iPhone. in simulator you won't get application try it in real device which has facebook and mail application installed

      – Paresh. P
      Jan 3 at 5:40



















    • ok so my code is perfect? Or need any implement? And i have to give any permission in info.plist or any other procedure to follow? Please explain in brief.

      – Krunal Nagvadia
      Jan 3 at 5:20











    • Check I have shared a code with you below in answer, This shares my App with link to all application which has sharing feature. like mail, facebook. but those application will appear in UIActivityViewController if those application installed in iPhone. in simulator you won't get application try it in real device which has facebook and mail application installed

      – Paresh. P
      Jan 3 at 5:40

















    ok so my code is perfect? Or need any implement? And i have to give any permission in info.plist or any other procedure to follow? Please explain in brief.

    – Krunal Nagvadia
    Jan 3 at 5:20





    ok so my code is perfect? Or need any implement? And i have to give any permission in info.plist or any other procedure to follow? Please explain in brief.

    – Krunal Nagvadia
    Jan 3 at 5:20













    Check I have shared a code with you below in answer, This shares my App with link to all application which has sharing feature. like mail, facebook. but those application will appear in UIActivityViewController if those application installed in iPhone. in simulator you won't get application try it in real device which has facebook and mail application installed

    – Paresh. P
    Jan 3 at 5:40





    Check I have shared a code with you below in answer, This shares my App with link to all application which has sharing feature. like mail, facebook. but those application will appear in UIActivityViewController if those application installed in iPhone. in simulator you won't get application try it in real device which has facebook and mail application installed

    – Paresh. P
    Jan 3 at 5:40













    0














    You have got UIActivityViewController presented now, Just add in text like,



    func ShareApp()
    {
    let items:[Any] = ["Marketplace of Building Material for Architects, Interior Designers, Contractors and Home Owners. Find Material for your next project. Download https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8"]
    let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
    self.present(ac, animated: true)

    }





    share|improve this answer




























      0














      You have got UIActivityViewController presented now, Just add in text like,



      func ShareApp()
      {
      let items:[Any] = ["Marketplace of Building Material for Architects, Interior Designers, Contractors and Home Owners. Find Material for your next project. Download https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8"]
      let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
      self.present(ac, animated: true)

      }





      share|improve this answer


























        0












        0








        0







        You have got UIActivityViewController presented now, Just add in text like,



        func ShareApp()
        {
        let items:[Any] = ["Marketplace of Building Material for Architects, Interior Designers, Contractors and Home Owners. Find Material for your next project. Download https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8"]
        let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
        self.present(ac, animated: true)

        }





        share|improve this answer













        You have got UIActivityViewController presented now, Just add in text like,



        func ShareApp()
        {
        let items:[Any] = ["Marketplace of Building Material for Architects, Interior Designers, Contractors and Home Owners. Find Material for your next project. Download https://itunes.apple.com/in/app/more-customers-app/id1280868223?mt=8"]
        let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
        self.present(ac, animated: true)

        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 3 at 5:37









        Paresh. PParesh. P

        6118




        6118






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016663%2fswift-how-to-add-app-sharing-feature-with-extension-sheet%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith