Trying to Write My First Xamarin iOS App

or, “Could they make this any more difficult if they actually set out to cause you to rip your hair out?”

As I believe I’ve written elsewhere (about a thousand times), Microsoft in 2018 is a far cry from what it was even a decade ago…for good and ill. On the plus side, I’m glad that my equity investment in Microsoft stock is finally doing well. The release of Windows 10, the shift in focus to the cloud, and their willingness to leverage their considerable development expertise in concert with others (e.g., the open source community) have reaped great dividends.

OTOH…

I miss the days when the development stuff they released wasn’t, well, just two steps above “crap” and one step into beta. I get that they are trying to compete in a marketplace where everything is always in beta, and new features are added to frameworks and libraries on a weekly basis. Change is good, particularly when it’s focused on improvements.

But if they don’t have time to test things, it’d sure be nice if they documented stuff in parallel with the releases.

Take Xamarin for iOS. On paper, it’s supposed to allow me to leverage my skills as a C# developer in writing apps for the iPhone (and other mobile platforms, too). That’s very attractive, since otherwise I will have to learn Swift, which is similar to but just different enough from C# that I would be constantly ripping my hair out trying to use it.

Only for the Xamarin approach to work, you need to have a Mac to use as a build server (that’s an Apple requirement; got one), an Apple Developer account (but apparently not the free kind that Apple offers — you need the $99 per year one; got one of those, too), and a bunch of software installed on the Mac build server (not terribly well documented, but good enough that I was finally able to figure it out).

iPhones only accept trusted apps (ones where Apple has approved of the developer). Xamarin claims to handle that automagically under Visual Studio 2017 (at least in version 15.7+). But it took me hours and hours of research and effort to get the automagic stuff to just work (if I had a dollar for every obscure and/or misleading error message Microsoft products display when they run into a problem, I swear I’d be able to at least give Ballmer a run for his money, if not Gates).

I’m still not quite sure how I got everything to work. I think it involved deleting my Apple Developer account from Visual Studio, and then re-adding it. But it may also have involved creating a new project within XCode on the Mac, which may have forced some certificates to update as a result of me moving from the free Apple Developer account to the paid Apple Developer account. I just don’t know (I can assure you, though, that it did not involve the entrails of any animal).

Even when Visual Studio finally installed the test app on my iPhone, it still wouldn’t run. Because I had to tell my iPhone to trust apps from “that there developer, i.e., me”. Only when you install the first untrusted app from Visual Studio on an iPhone, it does not configure the iPhone to let you edit its trust settings. Which means you can never run the Visual Studio-installed app.

So you have to go to your Mac build server, create a dummy iPhone app, download >>that<< to your iPhone, get the same “hey, this software developer ain’t trusted” warning…but that unlocks the “please trust this developer” stuff, so you can begin trusting yourself. If you ever did in the first place.

What’s the bottom line? I got everything to work, finally. I hope. But the Xamarin and Visual Studio teams should be ashamed that they released something that required that much work just to be able to run a boiler plate app (meaning “containing no code written by yours truly”) on an iPhone. Sheesh!

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Archives
Categories