Reputation: 1365
Xcode
has a view debugger tool that allows to inspect view hierarchy.
I am working on iOS Xamarin
app and would like to debug its view.
The app runs on a simulator launched from Visual Studio
.
Xcode's attach to process tool does not see PID of the running simulator.
How can I attach Xcode
view debugger to this process? Or perhaps there is another way of debugging view hierarchy of a Xamarin
app?
Upvotes: 6
Views: 2075
Reputation: 74094
Since you do not have an Enterprise license and thus Xamarin Inspector which is integrated in the Visual Studio debug workflow, you can use Xcode but of course you have to manually apply changes back to your C#/F# code.
lldb
to access the app and Mono prevents that via a ptrace
call (there are ways around this via breaking on mono_assembly_init_with_opt
and doing an early return on it, but that is another story)Debug/Attach to process by PID or Name
menu optionIf you do not know the process name, obtain the process id of the Xamarin.iOS
application that is running on the simulator
ps
ps ax | grep -i Weather | cut -d " " -f 2
7864
In Xcode attach to that process
Wait a couple of seconds
Now you can select View UI Hierarchy
from the process info icon (far right icon from the Process name/id) via View process in other ways
Note: View the process name and you can use that in the future instead of the pid
, in this case it is WeatherApp.iOS
(see screen shot, top left corner)
Note: The above screenshot is using the demo Xamarin.Forms
WeatherApp (xamarin-forms-samples/Weather)
Upvotes: 15