问题
I am trying to use Xamarin.Forms with Hot Restart to develop an iOS App, but I keep get the following error when running the app from Visual Studio:
An error occurred while trying to deploy the app 'TestApp2.iOS.app'. Details: Error running hotrestart: 'An error occurred while deploying the application 'TestApp2.iOS.app' into 'iPhone'. Details: Could not write content to file 'PublicStaging/com.companyname.TestApp2'. ErrorCode: EmptyResponse'. Command: 'deploy -u=00000XXX-001D4C6XXXXXXXXX -i=com.companyname.TestApp2 -n=TestApp2.iOS.app'
Details:
Visual Studio v16.8.2 (and v16.9.0 Preview 1.0) on Windows 10
Xamarin.Forms v4.8.0.1687
Xamarin.Essentials v1.5.3.2
I used "Create new project" in VS, with the template "Mobile App (Xamarin.Forms)" (Only iOS, no Android). I've not done any manual changes to the project after it was created.
I have enabled Hot Restart via Tools -> Options -> Environment -> Preview Features -> Enable Xamarin Hot Restart
The phone is connected to the PC via USB cable and I can see the name of my phone appear on the "Play Button" in Visual studio.
I do not see any activity on my phone and nothing in the VS device log that seems related.
Any help would be much appreciated!
回答1:
The phone is connected to the PC via USB cable and I can see the name of my phone appear on the "Play Button" in Visual studio.
You need a Mac and Pair to Mac for Xamarin.iOS development. Then we will see the following screenshot:
Now you can select one device from the device list to run.
================================update================================
First, enable hot restart in visual stuido 2019(here version is 16.8.2
). Not forgert to restart the visual studio after enabling it.
Second, make sure the iTunes has logined a paid apple account and connect a physical device via usb.
Third, set iOS as the startup project, then you will see your physical device:
Last, setting provisioning file in ios Bndele Signing:
Now you can run it in your physical device.
来源:https://stackoverflow.com/questions/65079433/error-when-deploying-xamarin-forms-ios-app-with-xaml-hot-restart