Code to share file path/file between a share extension and iOS app

后端 未结 3 1723
心在旅途
心在旅途 2021-01-04 02:18

I have added a share extension for my app say SAMPLE (already exists on the app store), called lets say SAMPLESHARE. Whenever a user, say takes a picture and tries to share

3条回答
  •  囚心锁ツ
    2021-01-04 02:37

    Your question is a bit messed up but if it is about passing data from one app to another app you have a great solution for that which is UIPasteboard

    If you don't have any problem for jumping between apps using custom URL handlers then you have 2 more steps left.

    Step 1
    In your first application which is responsible for passing data implement these methods and then call custom URL.

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    [[UIPasteboard generalPasteboard] setImage:passImage];
    


    Step 2
    In your target view controller simple call UIPasteboard again and get the data from it.

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
       UIImage *getImage = pasteboard.image;
    


    Please note, that you pass a UIImage and you get it in the same type

提交回复
热议问题