Building iOS App does not update on iPhone or Simulator - ios

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."

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.

Related

Xamarin iOS project suddenly gives 200+ errors (Visual Studio for Windows)

After four weeks, I returned to my Xamarin project in Visual Studio to finish my app, I updated Visual Studio on my Windows PC, I updated XCode on my Mac and when I try to launch emulator, I get this:
I changed nothing in the code, it worked previously. The only thing I can think of that could f*ck all up is I was trying to prepare my app for testing (so I was doing some stuff in developer account settings, provisioning etc.)
Does anyone know how to fix this, or at least what it means?
Thanks!
Okay, turns out the problem was in version mismatch :) All I needed to do was click "Update on Mac" in the "Connect to Mac" window.

Xamarin Visual Studio ios simulator not working

We recently acquired mobile solution that contains an ios and android project. Android project runs fine. When i run the ios project i get error stating
My environment is a windows laptop and a macbook pro running visual studio from windows.
I can pair to mac just fine
I am using automatic provisioning which appears to be correct since my team shows up in the team dropdown.
I feel like i did the provisioning correct because team would not show up in dropdown if not.
I have latest xcode installed on mac
I verified simulator runs fine on mac by starting through xcode
In the videos i watched as soon as mac was paired then more options appeared besides just simulator. (ipad, tvos, etc)
One question is when i registered my device i used the UUID from the macbook and not UUID of simulator. Could not get straight answer for this.
To be clear i am just trying to run the simulator and not a remote device.
Honestly i just want to be able to test the ios application. It should not be this many steps to just run a test. Is there a more simple way to test or am i on the right track?
Updating visual studio on my windows machine did the trick. I really wish the error would give me some kind of warning that would lead me to the conclusion that i needed to update visual studio. That would have saved me many hours.

Error MT0026 on Xamarin Forms

I'm trying to run an iOS simulator from my Xamarin Forms project. I had it working a month ago, and when I returned to it, I get the following error:
error MT0026: Could not parse the command line argument '-sdk': Version string portion was too short or too long.
I updated all the NuGet packages and updated Xamarin itself.
The only thing I can find on the issue is here: Xamarin.iOS Errors
Also, my mac is up-to-date and I made sure xcode was up-to-date as well.
I had exactly the same error when I first started Visual Studio on MacOS. For me the list of device emulators was empty. The only available device listed was "Generic Device". After I restarted Visual Studio all available simulation devices turned up:
Actually this appears whenever you make an important OS update. Why?
Because usually something gets changed into Xcode and one needs to open the app to agree whatever they want you to agree.
After that, restart Visual Studio and everything is back to normal.

Xamarin iOS Simulator running old code

When I debug my Xamarin.iOS project from Visual Studio, it builds, installs on the simulator, and launches the app without issue. But on launching, I'm seeing a bunch of Debug tracing from a method that doesn't even exist in my C# code anymore. I can also set breakpoints on the class from which I removed the method at the same line numbers where this method used to be, and I will see the removed method in the call stack when the debugger stops.
I've closed and reopened Visual Studio, reset the connection to the Mac build server, cleaned and rebuilt my solution, and manually deleted the solution output. On the Mac, I've closed and reopened the simulator, and tried Reset Content and Settings, which does clear out the app. But the situation still persists, even after all that. Is there something else can I try on the Mac to make sure that all cached copies of old code have been deleted?
In your project folder delete the bin and obj folders. This works for me but is still annoying.
Check your Configuration Manager (the drop down with Debug, Release etc) and check that all the projects are being built. It usually unchecks all the projects you are working with for some unknown reason.
This means that it isn't rebuilding all the projects and it hence shows an old version.
As per your comment of rebuilding each project, this is a classic sign of the projects not being checked to be built on run and why you have to do it manually.
In the iOS Simulator (on the Mac) click the "Reset Contents and Settings" entry the main menu.
Well this worked with my Android project suffering from the same issue:
Right click on Android project then select "Properties".
Select "Android Options" then "Packaging".
Un-check the "Use Shared Runtime" options.
then it worked normally
I had a similar problem (though on an Android emulator).
What didn't work for me:
restarting the computer
restarting Visual Studio
deleting bin / obj folders
going into Configuration Manager (Debug / Release / Configuration Manager) and ticking everything there - everything was ticked
changing the version of the app in the manifest
What worked for me?
Uninstalling the app from the emulator and then running Debug again.
It was an Android emulator, so I uninstalled by clicking on the app icon and holidng for long, and then dragging it to "Uninstall App". On an iOS simulator it should be similar.
In my case I had to enable all architectures:
Android project properties
Andrid Oprions
Section Anvanced Tab
Select all architectures and rebuild
I still have this problem with iOS simulators. My solution:
Unload the iOS project
Reload the iOS project
Build as usual
I do the above when I change simulator device.

(Windows Phone) Localizing App Title

I have followed the quick guide on MSDN to localize my WP8 app title. Everything worked fine and I was able to see the localized app title from the emulator. However, ever since I added the C++ Win32 project (which was stated from the link above that it is a required project to perform localization), I am only able to build the project in x86 mode.
That is, even when I set in the Configuration Manager to compile for "All Platforms" it will still build for x86.
It didn't bother me too much until I try to run the app on my WP8 device. In which I got this error:
Deployment failed because an app with target platform x86 cannot be
deployed to Device. If the target platform is win32/ x86, select an
emulator. If the target platform is ARM, select Device.
So naturally I tried to set the build configuration to ARM, and Visual Studio still builds the app in x86 mode. I'd figured it might due to the Win32 project added for localization.
That being said, I wish to understand if:
Will the app still work if I upload this to the marketplace?
Is there a way for me to be able to test it on an actual phone?
Thanks!
Apparently the problem was caused by me trying to add a MarkedUp analytics reference to the project, and has nothing to do with the localization portion. I am sorry for the confusion. Case closed.
It happened to me too, but I haven't made your mistake. I found out that after adding that C++ project my WP8 project was set to build for x86 architecture instead of 'AnyCPU'. I set it back to 'AnyCPU' and it fixed it.

Resources