how to duplicate/configure new iMessage target config

I previously used the built-in template to add an iMessage extension target to my existing app and all is working fine. For development purposes I wanted to create a duplicate of the extension/container app pair, but with different bundle ID's. I duplicated the 2 Targets in XCode, and updated their bundle ID's and provisioning profiles. Everything is basically working, but for a few oddities:

1. If I Run the new extension, the debugger also launches and attaches to the old extension.

2. When I run the new extension, it does not automatically build and install the container app as previous pairing did

I searched through all the visible settings, and can't see where this behavior is determined. I manually editted the .xcscheme file and saw that the new extension was missing the RemoteRunnable section where BundleIdentifier = "com.apple.MobileSMS" was specified. I couldn't find that anywhere to set that in XCode UI, so I manually added to the xcsheme, but didn't fix the oddities. Anyone know how to fix this?

Replies

The root of my problems with duplicated Container-Extension targets is that the .entitlements files did not get duplicated/assigned properly. My Extension did not have any entitlements at all, and the Container target was still pointing to the same entitlements file being used by the original app. This caused a variety of odd behaviors in iMessage.