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?
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 aptrace
call (there are ways around this via breaking onmono_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 simulatorps
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) viaView 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 isWeatherApp.iOS
(see screen shot, top left corner)Note: The above screenshot is using the demo
Xamarin.Forms
WeatherApp (xamarin-forms-samples/Weather)