IOS9 Share Extension cannot debug Xcode

When I create a sharing extension from Xcode for a real device, Xcode arbitrarily stops debugging. But when I run the simulator, the problem does not occur.

Environment
Xcode 7.1.1
iOS 9.1

Image Details When I create a sharing extension, Xcode shows “Ready to launch MobileSafari.app on iPhone”, but Safari does not start. And, the square stop button is arbitrarily gray. So, I run Safari myself and choose the extension and post. The debug section does not show anything. In addition, the URL is not sent by the Rails server.

This is an image when I create an extension for a real device. enter image description here

I do not know why the real device cannot start the sharing extension on Xcode.
If anyone knows the answer about this problem, please tell me.

+8
xcode ios-app-extension
source share
2 answers

You can usually debug a shared extension by going to Debug → Attach to process or PID and entering the name of your extension. From there, you can open the sharing extension on your device or simulator, and the Xcode debugger must correctly connect and remove breakpoints. However, I noticed that the log messages are not displayed when doing this, and the values ​​are not populated for the variables in the debugger view.

This is how I got debugging to work correctly. Run the sharing extension scheme. When he asks which application is starting, select "Photos" (because this application will work with your add-on). Then the Photos application will launch on your device and you can continue to use the extension. The debugger in Xcode should work as expected.

+6
source share

I also ran into this problem, although, unfortunately, I do not know the exact solution, maybe I can offer some information that may be useful.

I (like you, judging by your screenshot) used Cocoapods, and Cocoapods copied resources from containers to the application extension kit after it was signed with code. If the memory works, it somehow interferes with the code signing and, therefore, prevents the application from running under the debugger.

I believe that one of the symptoms of this was that the logs appeared on the Mac console (or the device’s console, which they don’t remember that) say something about “exploding on the device using the old skool [sic] method”.

You could confirm that this is so by removing Cocoapods from your project or any containers that require copying resources after compilation. I believe the solution was to add some special build phase to the extension project, to copy the package resources, and disable all Cocoapods by default.

As a temporary solution, I believe that removing your application from the device should allow you to attach the debugger once, at startup, where the application is installed for the first time. You can also try deleting derived data for your project.

0
source share

All Articles