I wanna know which app calls the share extension to share image to my app(its bundleId or appName). But I found no way to do it. There is none information about the source app in NSExtensionContext. I would greatly appreciate any help.
3 Answers
To achieve what you're asking:
#ifdef HIDE_POST_DIALOG
- ( void ) willMoveToParentViewController: ( UIViewController * ) parent
{
// This is called at the point where the Post dialog is about to be shown.
NSString * hostBundleID = [parent valueForKey:(@"_hostBundleID")];
NSLog( @"**** parent bundle id is %@" ,hostBundleID);
}
#endif

- 9,564
- 146
- 81
- 122

- 86
- 1
- 4
-
Where's `_hostBundleID` officially documented? – Pang Feb 07 '18 at 04:46
-
2Will using this get your app denied for submission? – kobi Sep 09 '18 at 19:49
-
@Pang I also found this value here: https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/UIKit.framework/_UIViewServiceViewControllerOperator.h – kobi Sep 09 '18 at 19:56
-
@Pang Have any of you found a way to discover the different keys? I would like to be able to find the host app's url scheme so I can open the host app from my containing app later after the host app shares to my share app extension. – daniel Jul 22 '22 at 09:58
You don't get to find out what app is hosting your extension. That's not part of the extension system. You get to find out what kind of data the app is passing you and, with action extensions, you get to return some data. But you don't get to find out who you're dealing with, only what data is going back and forth.

- 69,312
- 10
- 146
- 170
Your bundle ID is usually com.yourcompany/yourname.yourappname
If you don't know what Xcode has for your company name, create a new project and the screen that prompts you for your app name will have your company name.
Also you can do this,
In Xcode, select your project, then your target (you should have only one) and then the 'Info' tab. You should be able to see the bundle identifier there.
The answer to this question can be found here:

- 1
- 1

- 355
- 3
- 10