Category Archives: IOS

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.

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.

My iOS8 adventure as a Xamarin developer

With this post I sum up my experiences with iOS8 as a developer. If possible I will provide solutions and workarounds.

The release of iOS8 is really unfortunate for me. A lot of my demos have stopped working and it seems like there are some really annoying bugs in iOS8.

Update: Added working example for reachability

Update: Apple confirms bug in iOS8 Simulator regarding backgrounding.

Update: explanation for the NSUrlSession issue found!

iOS8 is draining your iPhone’s battery? Maybe here’s why.

If you like me are an early adoptor of iOS8 – be it because you’re just or curious about the new feature, or did it for work – you might have noticed that your device’s battery life might have decreased a lot. Yesterday I talked to some developer-friends and they told me: “You know what’s cool, iOS8 keeps on running threads even if applications have been backgrounded!” I was baffled.

UPDATE: This post has been moved and is now part of http://krumelur.me/2014/09/23/my-ios8-advent…arin-developer/ ‎

Visual Studio fails to connect to Xamarin Build Host

Is it one of those rainy days where you sit in front of  your Mac and would like to try out the latest and greatest Xamarin features like Xamarin.Forms and then Visual Studio refuses to connect to the Xamarin Build Host?

Xamarin Build Host

You did not change anything of course. It just stopped working over night. That’s what computers do to keep us busy. Your options: Xamarin support? Takes to long, so let’s resolve this all by ourselves.

Making UITextView’s size exactly fit its content on iOS7

Sometimes you might want to add a UITextView as a subview to your layout, give it a specific width, assign some textual content to it and then make the text view exactly so high that it won’t scroll.

Back in the good old days of iOS6 one would just set the Frame size to the ContentSize of the UITextView. Done. But this does not work any longer on iOS7.

Making UITextView’s size exactly fit its content on iOS7

Sometimes you might want to add a UITextView as a subview to your layout, give it a specific width, assign some textual content to it and then make the text view exactly so high that it won’t scroll.

Back in the good old days of iOS6 one would just set the Frame size to the ContentSize of the UITextView. Done. But this does not work any longer on iOS7.

Management of iOS provisioning profiles with Xamarin

Recently I ran into some problems with iOS provisioning profiles while using Visual Studio for Xamarin. Some profiles wouldn’t show up and in the end I got super confused and started to wonder:

  • I’m inside Visual Studio here on a Windows machine and it shows me a list of profiles. Where do they come from?
  • There is Xamarin Studio on the Mac (the build host) and it also has a list of profiles. In addition it allows me to log in to my Apple developer account.
  • And we have Xcode. Guess what: provisioning profiles there, too and also a login dialog.

In the good old days, everything related to profiles was managed in the Xcode Organizer. Then Apple decided to strip Organizer down to the bare minimum and include everything into Xcode’s preferences.

Post has been updated because of changes in Xamarin Studio

Xamarin, your first iOS application and the transition to Android: a Screencast for beginners

These days at school, chances are high that your first contact with programming was with C#, just like it was C, C++ or Java years before. Maybe you made some “Hello World!” application for the text console or used WPF to “design” your UI and then do something on a button’s click. That’s all fascinating but you don’t really see why you would put further effort into this. And so the basic C# knowledge sits there in the back of your head, waiting to be resurrected.

Hello_World_App

Hello, World! – I am a software developer

Xamarin Recipe Cook-off: Using SpriteKit on iOS7 with C#

monkeyIn this post I’m going to walk you through a tutorial that will show you the basics of Apple’s new SpriteKit API for iOS7. To follow the tutorial, you will need basic knowledge of iOS application development and C# / Xamarin.iOS.

To build the demo project, you will need Xamarin.iOS 7 (Indie Edition will do), Xcode 5 and iOS SDK7.

If you don’t know what SpriteKit is all about, you can check out the details on Apple’s developer pages (a developer account is required to access them): SpriteKit introduction

For all you eager-beavers who cannot wait to download the project before even knowing what it is all about, here’s the link:

https://github.com/Krumelur/KSBoingBall

Let’s have a look at what we’re going to build:

The demo's main scene showing the bouncing ball.

The demo’s main scene showing the bouncing ball.

Some folks may recognize the ball: it’s the good old Amiga Boing Ball from the 1980s! I found a perfect remake of its animation at the AmigaLog where the images can be downloaded. Very well done and perfect for our little tutorial.
Of course we want to tweak things a bit in order to show SpriteKit’s abilities, so my version has an option to let it snow – not just because it’s already close to that time of year, but mainly to demonstrate the use of particle effects:

Main scene with particles enabled.

Let it snow!