Author Archives: krumelur

But I don’t need the complete Github repo!

We all love example code and there’s plenty of code hosted on Github. Xamarin for instance has a large repository at And of course Github makes it very easy to download such a repo by just hitting the big green button:

Button to download a Github repo

Download a repo

But right now I’m on the train, tethered to my iPhone and I just don’t feel like downloading the entire repo, all I want is the CoinTime game app!

Here’s how I solve this problem: instead of using Git, I use Subversion (SVN) which is supported by Github, too. Just open Terminal and run the following command:

svn checkout <URL>

where <URL> will be replaced with the actual project to clone.

In my example, CoinTime’s URL is:

To use SVN, we simply replace “tree/master” with “trunk” and the command becomes:

svn checkout

And we have a subfolder named “CoinTime” with exactly that one project in it!

Using OAuth2 with Microsoft OneDrive and Xamarin.Auth

Last week I had an interesting question about Xamarin.Auth, a library that allows Xamarin apps to authenticate users via standard authentication mechanisms (OAuth2), and store user credentials.

You can see how I wrote the word “standard” in bold because as long as some OAuth2 service follows the standards, Xamarin.Auth should support it. So my answer to whether Xamarin.Auth will work with OneDrive’s OAuth mechanisms was clearly “of course, it does”.

I was wrong.

iOS Background Transfer – what about uploads?

Downloading files in the background is easy with iOS since the introduction of the NSUrlSession background transfer APIs. There are plenty of examples and instructions around for ObjectiveC but also for Xamarin.iOS.

Documentation about the APIs is pretty exhaustive over at Apple and covers everything you have to know to get started.

And then, you start asking yourself: what about uploading data? And it turns out there aren’t so many working examples and in fact it can be quite tricky to get things up and running. I was in contact with Apple support and they helped me to find answers to many of my questions. This blog post is trying to conserve to essence of my mail communication as it can help others who are challenged with implementing background upload.

Launching an Android Activity of another APK

We have discussed Android and its Activity system today. It is quite hard to grasp for an iOS guy like me; it feels…special.

I certainly know how to start an activity within my own app and I understand the difference of an explicit Intent vs an implicit one. But there are a couple of questions I couldn’t find answers to, particularly not something that would show how things work with Xamarin.Android.

So I created a small test app to answer the following questions:

  1. How can another app be launched directly?
  2. How can an Activity of another APK be started via an explicit Intent?
  3. How to implicitly start an Activity of another APK?

Xamarin.iOS, the garbage collector and me

A lot has been written about the Garbage Collector and Xamarin.iOS. Lately, I’ve been hit by some surprises and I want to share my findings. Let me say that there is not a single bug involved! All the issues I describe are either documented or show standard behavior of the .NET runtime. The fact that Xamarin.iOS lives on top of a reference counted world makes things a bit more difficult.

Many thanks to Rolf Bjarne Kvinge for his patience, Marek Safar for sharing the secrets of Mono compiler with me, Rodrigo Moya for helping me with the Xamarin Profiler, James Clancey for his drawings about native reference cycles 🙂 and Chris van Wyk for supporting me in these moments of “good god, this cannot be!”

Adding async/await to CocosSharp actions

UPDATE: The CocosSharp team has decided to integrate my ideas directly into their source! 🙂

Are you a C# programmer? Using Xamarin? Are you interested in making great games that run…

  • cross platform,
  • from one code base
  • and are powered by Cocos2D and XNA?

If yes, then you should check out CocosSharp!

I used Cocos2D in the past (the “good” old days of ObjectiveC…) and liked it a lot. Seeing all this translated to C# just freaks me out! 🙂

However there has been one thing that bugged me: chaining actions and running actions simultaneously.

Say, you want your character to scale, then increase some score counter, afterwards make the character jump and then reset the animation phase to the default frame. You would use something like:

var scale = new CCScaleBy (1f, 1.5f);
var jump = new CCJumpBy (1f, new CCPoint (100, 100), 50, 2);

this.RunActions (scale, new CCCallFunc (() =&gt; this.UpdateScore ()), jump, new CCCallFunc(() =&gt; this.SpriteFrame = this.defaultFrame));[/code]

Works, but with the power of C# we can do better!

Fix too small iOS Simulator on Retina Macs

Recently I received my MacBook Pro. It’s the 13″ model with Retina Display. I run it in the 1680×1050 HiDPI mode to get more content on the screen (I use the nice little tool called QuickRes to conveniently switch resolutions).

Before I had the MacBook Pro I was working on a MacBook Air with significantly lower resolution and when testing my iOS apps in the Simulator, I had to scale the Simulator down to fit on my screen. This can easily be done by pressing CMD+1 (100%), CMD+2 (75%) and CMD+3 (50%) or via the Window -> Scale options.

Now with the MacBook Pro it is the other way round: an iPhone 5 is simply too small even at 100%. See the screenshot below.

Migrating from Parallels Desktop 10 to VMware Fusion 7: Android SDK broken, WP Emulator not working

Recently I switched my Parallels Desktop 10 VM setup to VMware’s Fusion 7. I had various (random) problems with Parallels Desktop 10 and decided to give Fusion a try. The result: Fusion 7 does not support all the fancy DirectX 10 support, but for a virtual Windows 8.1 development machine on my Mac, it is the better choice.

Migrating over was easy: I simply imported the PD10 virtual hard disk. In 30 minutes it was converted over into Fusion’s format and started up just fine. Everything worked pretty well but then I found a view things I had to adjust.

Are you a creature of habit like me? Then this setting in OS X could get you into an awkward situation too.

The story is actually funny, but on the other hand not. What would your reaction be, if you noticed that you just sent your login password out to the world? I can tell you what mine was:

Captain Picard Meme WTF?

Upgrading my mid 2011 iMac (27″) with an SSD

Back in early 2012 I banned the last PC from my home and bought an iMac:

Bildschirmfoto 2014-11-09 um 19.25.35

It had the fastest processor back then and I upgraded it to a total of 24GB of RAM (it was shipped with 2x2GB – I chose the minimum config because RAM is so much cheaper if you buy it from Amazon). The only thing I did not buy, was an SSD. The price would have been an additional €600 and that would have pushed it towards the €3000 barrier. Too much. So I ended up with a 2TB hard drive, spinning at 7200rpm.

The machine was (and still is!) powerful enough to do al the work I demand from it. But at some point I installed Windows 8 in a Virtual Machine (running Parallels 10 meanwhile) and the HDD became more and more of a bottleneck. If Mac OS wasn’t accessing the disk, Windows surely was. The rumbling sound of an HDD being accessed became my constant company.

So I thought about buying a new Mac – but what for? Just to get an SSD? I mean the new 5K iMac is great but mine is still powerful enough. Too much money. Next, I talked to Gravis about adding a Fusion Drive. They asked for €450; that would include a Samsung 840 Evo SSD with 250GB, installation, configuration, backup and restore of the current system. They also would allow me to keep the Superdrive. The SSD would be an additional device, hidden somewhere inside the iMac. When I saw the price for the SSD alone at Amazon I thought: €120 – can’t I just buy it there and install it myself? I started googling about installation guides and opinions about Fusion Drives vs. pure SSDs. Finally I decided:

  1. It cannot be too hard to install an SSD
  2. I do not want a Fusion Drive but rather put the OS on the SSD and large data (Aperture library e.g.) on the HDD for maximum performance.
  3. I can sacrifice my Superdrive

I want to share my experience because it is actually really easy to install an SSD into the mid 2011 iMac! If you have ever assembled together a PC, you will be able to do it, believe me! The whole procedure took me 40 minutes.

Please be aware that I won’t be responsible for any damage!