Customize the AirDrop alert description in IOS

后端 未结 4 969
盖世英雄少女心
盖世英雄少女心 2021-02-02 14:19

I have the following code to send a URL through AirDrop:

NSString* selfUrlScheme = [[[[[[NSBundle mainBundle]
                                 


        
4条回答
  •  猫巷女王i
    2021-02-02 14:37

    This question has been posted a looong time ago. I tried @Ivan's answer as well as other answers in the post, however, they just do not work!

    What I have originally is the image on the left. I am sharing custom data via AirDrop and looked at the title that is generated by UIActivityController by default "data-3A4F9D...", orz. What I want to achieve is a more descriptive title so that it is more readable for the recipient (image on the right). It seems that it is extremely similar to your question (even though I am sharing NSData while you are sharing NSURL.

    Here is what I do, which works pretty well: implement the following UIActivityItemSource protocol within my UIActivityItemProvider.

    - (NSString *)activityViewController:(UIActivityViewController *)activityViewController
              subjectForActivityType:(NSString *)activityType
    {
            // This returning string is added to the email title
            return NSLocalizedString(@"CustomTitle", nil);
    }
    

    If you are still having this problem, feel free to give this a try and let me know how it works for you.

提交回复
热议问题