Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS9 Share Extension can not debug on Xcode

When I build share extension from Xcode for the real device, Xcode arbitrarily stop debug. But when I launch for simulator, the problem does not occur.

Environment
Xcode 7.1.1
iOS 9.1

Details
When I build share extension, Xcode shows "Finished running MobileSafari.app on iPhone", but Safari does not run. And, The square stop button is arbitrarily gray. So, I launch Safari by myself and choose my extension and post. The debug section does not show anything. Also, URL request is not sent Rails server.

This is the picture when I build the share extension for the real device. enter image description here

I do not know why the real device can not launch share extension at Xcode.
If anyone know the answer about this problem, please tell me.

like image 386
penlight Avatar asked Nov 23 '15 12:11

penlight


People also ask

How do I debug a shared extension?

Go to that app on your device, create/choose whatever it is in the app that you want to share, click the share icon, choose your extension in the list of active sharing extensions. Then when your sharing extension starts up the debugger will automatically attach to it.

How do I enable debug mode in Xcode?

When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.

How do I share an extension in Xcode?

Add a Share Extension to your projectGo into the project section, click on the + button and select the Share extension from the list. Just call it Share or whatever name you prefer. The system asks you if you want to activate the Share scheme , just select Activate .


1 Answers

Typically you can debug a share extension by going to Debug -> Attach to process or PID and entering the name of your share extension. From there you can open the share extension on your device or simulator and Xcode's debugger should attach and hit breakpoints correctly. However, I've noticed that log messages do not show up when doing this, nor do values populate for variables in the debugger view.

Here's how I got the debugging to work correctly. Run the share extension scheme. When it asks you what app to run, chose 'Photos' (because that's the app your extension will operate in). The Photos app will then launch on your device and you may proceed to use your extension. The debugger in Xcode should then work as expected.

like image 76
GPRyan Avatar answered Nov 09 '22 13:11

GPRyan