london-meetup

That is one of the Xamarin staff there! I highlighted the Xamarin on his tee-shirt.

Last night I went to Shore Ditch Grind, a small cafe right by exit 8 of Old Street tube station (Northern Line) in London last night to meet some of the Xamarin staff, lots of developers (maybe 70-80) and indulge in the free drinks.

I was the bloke handing out my Bespoke Programmers business card.

Hi to Gavin, Dean Ellis (MonoGame team member) and Dennis and about six other people whose names I’ve forgotten.

It was noisy, crowded and very vibrant but having that many bodies in a relatively confined space made it hard to talk to more than 10 people. There wasn’t any purpose to the meeting, just to turn up, meet other developers and discover that as developers using Xamarin “We’re not alone”.

Things I discovered (note- it was a small sample – probably less than 10% of attendees) is that there are a lot of small developers and lots of people seem to have the Visual Studio “Business Edition” as do I.

Perhaps it would be worth organising a monthly meetup. Also I wonder if Xamarin would host a searchable page for all the small developers so anyone (big business) could find developers in their area.

A big thank you to Xamarin who footed the £1,000 bar bill and nice meeting you guys.

Being primarily a PC person since 1989, I bought my first Mac, a Mac Mini in 2008. I still have and use it but it can’t be upgraded to OS X Mountain Lion. And when they bring out a Mac OS X Mavericks how many years will my next Mac get used for. Maybe I should consider a Hackintosh!

So at some point I will need to move up. So for now despite having upgraded Xamarin as well as my iPhone to iOS 7, I’m stuck on developing for iPhone 6.1. To move to iOS 7 development you have to have Xcode 5 which requires OS X Mountain Lion.

Still at least I’ve tested my in development App on iOS 7 and it works fine on 6.1 and 7 though it doesn’t make use of any iOS 7 features.

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.

Another Xamarin update- I expect there to be quite a few with iOS 7 now hitting alpha on the Xamarin Studio front. However, MonoDoc keeps wanting to have Apple documentation merged with Xamarin.iOS documentation. Even though it’s done it already. It’s deja vu all over again. Last time it was Visual Studio!

monodoc-update

I talked earlier this week about these and have done further work. The problem I was solving was this: The App will be installed from the App Store but is only for a subset of users. It would be very bad if anyone else was able to use it.

So When it’s first run, it looks for Config info. As it’s never been run and this config info is set internally, it comes up with a screen asking for a few fields to be filled in, but only saves the data if a master password is entered. This information is saved out (password fields are used) and then the App kills the main View, recreates it ie effectively it restarts and upon finding the correct information it works properly. This was done in the View’s ViewDidLoad.

What I found was that the ViewWillAppear only appears to fire the first time and not the second following the View being disposed (UiViews are disposable) and then recreated in the a method in ViewController.

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
            }
        }

At times, some of the lockdowns on iOS can be quite frustrating. It can’t for example send email programmatically which presumably is to prevent spamming. The conversion I’m doing (from Windows Phone) has a requirement to log all functionality and occasionally email these logs.  Yes you can do it on Windows Phone!

Fortunately iOS does allow applications to access the web, so with a few lines of PHP script running on a domain I own (and host), I can have the logs sent via a URL POST which includes some magic values added so that the script can’t be easily abused by spammers. In any case the email is sent to one specific address. 

 

 

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