If you’ve ever wanted a light coloured text status bar, you may have experienced difficulties. If you have the current VS Plugin with current being (in iOS 8.1), Xamarin Studio 5.5.3. My VS plugin 8.4.0.0 and Windows Xamarin 3.7.23.0, then you’ll see you don’t have the choice of picking it in the info.plist editor. The choices are Default, Black Transparent and Black Opaque.

Those last two choices are now deprecated and there should be a Light Content. This changed in iOS 7.0 (see the iOS 7.0 transition guide).

For the fixes, I recommend that you edit info.plist with anything but the VS plugin, at least until they fix it. I use programmers notebook 2 which is excellent.

You need to add the following lines in info.plist:

	<key>UIViewControllerBasedStatusBarAppearance</key>
	<false/>

and in AppDelegate.cs you need to add the following line. I’ve shown it bold and in my code I’m using Tabs so create a Tab Controller (my own class) rather than the usual UIViewController.

            tabController = new TabController();
    UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
	    UIApplication.SharedApplication.SetStatusBarHidden (false, false);
            window.RootViewController = tabController;
            window.MakeKeyAndVisible();
            return true;

If you have a launch image you’ll probably want the status bar hidden during launch. If you had previously ticked the hide during application launch checkbox, it adds the following into info.plist.

	<key>UIStatusBarHidden</key>
	<true/>

What this also does with the Light Content fix is keep the status bar hidden so add the second line above (SetStatusBarHidden) as well to unhide it.

To try this fix out, download the code from here :Xamarin Sample for Tab Bars.

Next change the TabBarController so a tab or two is displaying dark colours.

			tab1 = new UIViewController();
			tab1.Title = "Gray";
			tab1.View.BackgroundColor = UIColor.Gray;

and add the one or two lines above to AppDelegate.cs

My Visual Studio started taking a longish- three to four minutes to load up and then the same when I opened a project. This started after the last Xamarin update. I’ve always found that for best results I have to reboot after an update and then unpair and pair. Sometimes my Mac Mini shows up in the Connection dialog as an IP address and sometime as the name. As the ip is DHCP provided, I figured out using the name was best however..

To cut a long story short, Zone Alarm did not like DNS queries for the Virgin DNS ( 194.168.4.100 and 194.168.8.100 port 53 ) which were resolving the Mac Mini and it was those being blocked that slowed VS down. I figure it must have been a timeout plus maybe some kind of fallback as I could still build projects on the Mac.

So if you ever get that kind of slow down, check your firewall!

I guess I’ll never know what actually caused this but renaming the project then creating a new one from scratch, adding everything back in and rebuilding it did the trick!

Over the years I’ve seen this type of thing happen once or twice. Visual Studio .sln files etc can be quite hairy and when something like this occurs, it’s often the easiest way.

I can still use it to edit and build manually on the Mac but it’s a pita. My software is uptodate (this happened after the last big upgrade), my PC and Mac are paired. The project compiles ok on the Mac.

But compiles and attempts to debug on Visual Studio all just output this and nothing more:

1>—— Build started: Project: TMRTaxi, Configuration: Debug iPhoneSimulator ——
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I suspect that this in the mbtserver log is to blame…

[05-Dec-2013 17:47:08] Activation error: Built request for POST to https://activation.xamarin.com/api/studio.ashx?token=1a6….. (shortened)
[05-Dec-2013 17:47:08] Activation error: Executing request -1080599872.
[05-Dec-2013 17:47:11] Activation error: Wrote request stream for request -1080599872.
[05-Dec-2013 17:47:13] Activation error: Got response 741550592 for request 741550592.
[05-Dec-2013 17:47:13] Activation error: Reading response 741550592.
[05-Dec-2013 17:47:13] Activation error: Read response stream for response 741550592.
[05-Dec-2013 17:47:13] Activation error: Updated license: iOS Business 05/06/2014 14:43:26

Very frustrating!

Near the end of a project and there’s nothing worse than getting a new release of the development software and getting a real big scare. I got 7.0.4 this morning with the new pairing of Visual Studio to the Xamarin.iOS Build Host running on the Mac.

Mac and Windows Pairing Dialogs

That worked well, but the scare came when I went to upload the newly built app on to my device and got a No Provisioning Profiles Found build error. Weird but as I’d renewed my developer account with Apple yesterday, possibly it was related to that but no it showed fine. The profiles on the iPhone showed fine as well in the Xcode organiser.

Dev profiles in Xcode's organiser

I was a bit worried because my Mac is only 10.7.5 and can’t run Xcode 5 or develop for iOS 7. It will be replaced shortly. However it turned out to be a lot simpler than that. In the Xamarin Studio Preferences, the Developer accounts had been zapped. Just adding my Apple account back in sorted it.

Xamarin Studio Developer Accounts

Failed-dissassemble

Occasionally I’ll get a crash that needs Visual Studio 2012 to be restarted and just now and then I get a Catastrophic failure Exception 0x8000FFFF (E_UNEXPECTED) at EnvDTE.Command.AddConrol at Sil.VSCommon.SilAddInstance.CreateUserInterface(). Once a week or less frequent.

I suspect it’s the Xamarin Plugin, but it might not be so has anyone else seen this?

The answer is just to restart VS.

I’ve noticed that if I’m away from my PC for a while (generally over an hour), Visual Studio loses the connection to the Mac Build Host. When I try to reconnect via the Visual Studio Tools/Option/Xamarin/iOS Configure button, it won’t reconnect. The Mac build host is shown as unreachable and Diagnose fails trying to talk to the Mac.

Restarting Visual Studio doesn’t do it, you have to close down then reopen Xamarin Studio. It’s 4.0.12 (build 3). Then you can reconnect from Visual Studio. Not a big bug, just a minor PITA!

One of the nice things about Visual Studio 2012 is the Code Analysis. It’s worth doing to try and find underlying problems and I found some in mine. The code worked fine, but Code Analysis told me I was doing naughties with a Virtual Method in a constructor.

Mea culpa. I was indeed. I’d created a View object with my Subclassed View in a CustomViewController.

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View = new MainView(UIScreen.MainScreen.Bounds);
        }

But I’d been doing all sorts in the MainView() constructor that needed not to be there, though it had seemed to run ok. If configuration data is absent I want to stop things and have it entered. So I was creating SubViews (Controls) and then calling the UIView.AddSubView() that MainView inherited from within the Constructor. Shock Horror Probe! Bad Code Alert…

The risk is that a virtual method may not have been correctly assigned and the compiler doesn’t really like Constructors in C# to have to worry about this. After a Constructor has finished, things should be just swell.

The trick is to move the code into a subclassed ViewController.ViewWillAppear(). This is called whenever the View is about to appear. Use a bool variable to let things that should be initialized here just the once be only called just the once.

        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            if ((View as MainView).ConfigCheck() && OneOff)
            {
                OneOff = false;
                // one off code here
            }
        }

Today i got the dreaded 0xE8008016 when I tried to deploy a test version onto my iPhone. This can occur for a variety of reasons so I checked everything pertaining to profiles and provisioning:

I ran KeyChain, I ran Xcode Organizer, checked my account on Apple. All were good though my Apple developer subscription must be well into extra time as it’s renewed around this time of year but I knew they’d extended everyone’s because of the problems they had a few weeks back.

0xe8008016

It was none of those. However I did notice a file Entitlements.plist that hadn’t been there before and I had accidentally enabled it in the Project Settings. Unticking it solved the problem for me.

entitlements

This is on Windows 7 and happens every day if I don’t start the Xamarin Bonjour service before Visual Studio and opening a Xamarin.iOS project. It’s not that big a deal but something must be switching the Xamarin Bonjour Service from Automatic. I set it to automatic a few times but it gets reset to Manual. Once it’s running it stays running for the rest of the day.

bonjour-initialization-failure


If you get this make sure the Bonjour Service is running. If it’s not, open the services MMC. You can do this from Task Manager but make sure on the Processes tab you click the Show processes from all users button as the service may not start. Then on the services Tab in Task Manager, at the bottom right then when the Services MMC opens scroll to the bottom. If you don’t see Started then right click on the service and click Start.

bonjour-service

Hopefully you should be able to select iPhone 6.1 in the combo box and all will be well. If not see this tip on Visual Studio to Mac Connectivity.