问题
I am trying to get an iOS project started with Xamarin.iOS for Visual Studio linked to a Mac build host and connected iPhone.
I have started dummy projects in Visual Studio on my PC, Xamarin Studio on the Mac, and XCode 7 on the Mac. They all share this problem.
I have tried running the build on both the physical iPhone and a Simulator on the Mac. The problem persists for both despite all my efforts.
The problem is this: The first version ever built of the test app is the one that runs. If I make ANY changes and rebuild, those changes will NEVER be reflected in the app running on the phone or simulator. It will ALWAYS run the first build I ever made, and the debugger refuses to attach.
I have tried deleting the app from the phone between builds. I have tried deleting all bin and obj files from all projects in the Visual Studio solution between builds. If I could find any similar files on the Mac for Xamarin Studio, XCode, or the Xamarin Mac Build host, I would delete them too, but I'm unfamiliar with the build process or file system of a Mac. Still, this is a problem that shouldn't be happening Regardless.
I have even tried restarting Visual Studio. I would have tried restarting the other parts of my setup (the Xamarin Build Host, Xamarin Studio, XCode, the iPhone, and the iPhone Simulator), but decided not to bother, since restarting components between every build is unacceptable and not a solution.
All searches I do on the web only bring up topics related to Apple Provisioning for test deployment. Nothing useful. Very frustrating. Does anyone have any idea what might be going on here?
Edit: Correction. Changes made in Xamarin Studio on the Mac are reflected on build/run, but not from Visual Studio on the PC linked via Build Host, or from XCode.
Also note: All 3 test apps use the same app identity in their plist files ("com.somecompany.-"). And when building in one environment (say Visual Studio) it WILL overwrite the version from the last environment used (say XCode), but it will still use the first version ever made in the environment being built from.
So for example, if the main page on the Visual Studio project has a label saying "This is the VS version.", and the XCode project label says "This is the XCode version.", I can build/debug in either one, and the label will say the expected thing on the phone.
But if I change those labels in some way, like by adding " duh..." to the end of them so they say "This is the VS version. duh..." and "This is the Xcode version. duh...", no matter how many times I build and run in either environment, the app will still just say "This is the VS version." or "This is the XCode version."
回答1:
Partially solved. (Solved for Visual Studio with Build Host, not for XCode)
In Visual Studio, the test project is a Xamarin.Forms solution, meaning that it consists of a library project--"TestApp (Portable)"--and other projects for each platform it should build for--"TestApp.iOS", "TestApp.Driod", etc.
By right clicking on the solution and bringing up its properties, then going to Configuration Properties -> Configuration, I was able to see that the library project was not set to build for some reason. So the iOS project would build, and everything would LOOK like the compiler was doing it's job, but the iOS project was still building off the non-rebuilt library.
After checking the box for "Build" on the TestApp library project and applying, everything worked. The debugger even attaches again.
Unfortunately, XCode still remains an unintuitive and mysteriously useless piece of scrap. Answers regarding its behavior on this matter would still be appreciated.
来源:https://stackoverflow.com/questions/34210544/building-ios-app-does-not-update-on-iphone-or-simulator