Creating a share extension

I’ve been looking into creating a share extension so that the Share button in Safari could be used to send a URL to my app. I’m not sure if I’m interpreting the Apple documentation correctly, but it looks like you can only create one for an application that’s built with Xcode (since the extension can’t exist as a standalone, and you must specify the target as part of an Xcode project). Is that correct? Or has anyone been able to build such an extension that can be used with a Xojo project? Another option might be to create a specific Safari extension with it’s own button (i.e. not using the Share button).

I think you’ll need to use Xcode for that to implement the interfaces apple requires.

You could set a custom URL Scheme for your app and use a bookmarklet in Safari to send the current url to your url

Yes, you need to use XCode to create the extension. But my question is can you bundle such an extension inside a Xojo app? As far as I can tell that’s not possible. But is it? And if so, how (since in XCode it seems the parent project must also be in XCode).

@Scott, thanks. I googled for bookmarklet and safari and didn’t turn much up. Can you point me towards any documentation for this? And by “setting up a URL scheme” for the app I assume you mean a response to an AppleEvent?

Wouldn’t that be a case for NSSharingService? And is that not one of the classes that is 64bit only now?

URL Scheme as in myapp://somelink. There is a list of apps that use url schemes here:

For example:
iTunes uses them when you click a link to an album or app on a webpage and iTunes application pops open to that album.

I have not set up any apps on the receiving end, but have used url scheme links to send info to different apps. It looks like you would set the custom url part in a plist file included in your app. I’m not sure how you handle the information in the url link when your app launches from the link.

For the bookmarklet:''+escape(location.href),'name','height=300,width=300');

this example takes the current browser address and creates a qr code of it though Google. Within “” you would have this be your link. You can set this as a bookmark in your bookmarks bar or menu and click it for a qr of the the current page address.

@Ulrich Bogun – yes, it may be, and I saw that 64 bit requirement, too. I must say that the documentation is so complex, however, that I wanted to ask on the forum.

@Scott Siegrist – thanks for this information. I’ll look into this.