You are here

iOS

I gave in and I tried this Candy Crush game that everyone was talking about. I'm hooked.

Let me be clear. Five lives per day is a perfectly healthy number. It gives you some time for leisure, and then you are forced to assimilate back into society as a contributing member.

That said, I get just as much fun from taking toys apart as from playing with them, so I started tearing it apart to see what I could do about these limited lives.

These are notes, not instructions. A developer should have no problems here, but if you need step-by-step instructions you'll need to look elsewhere. Better yet, just buy some more lives/items.

The Save File

Your belongings in the gave are saved in a save file, called save_XXXXX.dat, where XXXXX is some sort of timestamp. This file is present in the app's sandbox once you have played the game. It is a binary file. If they used a serializer, I'm not sure which one.

For an iOS device you can read and write to the filesystem using DiskAid.

The process for reverse-engineering save files is no mystery. Copy the save file. Make a change. Copy the save file. Compare.

A custom control, like the calendar component shown here, requires many subviews. In fact, to generate this view requires about 700 subviews, unless manually user-drawn.

Apple's AutoLayout was introduced in iOS6 to provide a means to layout user interfaces independently of screen size, aspect-ration, and resolution. Unfortunately it is very ineffecient and appears to have an order of O(c^n) i.e. every subview added makes the layout take exponentially longer.

The control that is shown, designed to use AutoLayout, takes up to 10 seconds to render on an iPad. This essentially makes it unusable.

In examining the execution using Instruments I came to the realization that it was all Apple code that was swallowing all this time. Eventually I found two others who came to the same conclusion the hard way:

By turning off AutoLayout, the calendar renders (incorrectly of course) in a fraction of a second. I'll be spending this weekend writing my own MagicLayout code, which will be used by the cross-platform component library that is in development.

I am currently developing a C# / .NET user interface platform that will finally allow you to write the UI once in C# and create:

iOS applications using Xamarin.iOS

Android applications using Xamarin for Android

Windows Store (WinRT) applications

I will consider adding Windows Phone and Silverlight, which should be easy ports.

The platform will include an attractive and flexible calendar control.

The project will represent about 500 hours of development. The components will be released under commercial license. The target price is $200-300. I hope to release many building blocks of the platform under an open-source permissive license.

The calendar component is currently in alpha release.

If you would like more information, or would like updates as they become available, please contact me.

Introduction

My softball team thought it would be fun to play intro music for each person as they went up to bat, like some major-league teams. I welded together a portable sound system complete with pneumatic wheels, second-hand shelf speakers, an AGM battery, and a 40W head unit.

I recently purchased a refurbished iPhone 3GS from an online retailer. I needed one for testing an application that I've been hired to build. Since I had the iPhone anyway, I figured the touch interface would work well for our team's sound box.

The Problem

The first problem, I learned, is that the iPhone cannot play a single song, then stop. It always continues on to the next song unless it is the only song in a playlist. Luckily I wasn't the only person who found this extremely stupid, and before reaching for my compiler I checked the App Store and found Benjamin Pung'sOne track Mind app.

The next problem was that when I plugged in the cord from the headphone jack of the iPhone to the Line In jack of the head unit, there was an annoying beat, beat, beat sound.

For the benefit of those searching, it could also sound like: click, click click; thump, thump, thump; pop, pop, pop; beat, beat beat.

I considered loose connections, impediance mismatch, and EM interference, but I was able to rule those out. Oddly, rebooting the device would make it work normally until I fiddled with the jack (I still haven't figured this out).

It is noteworthy that this symptom is not present when listening with headphones (this is where, I believe, impediance plays a role).

The Solution

Many internet searches informed me that this was a very common problem without a solution.

I notice that pushing the plug into the jack forcefully and holding made the noise stop. I also noticed that when I did so, there was just a little end-play; maybe 0.2mm. I had a hunch.

I grabbed a toothpick and went digging. I scraped the tip of the toothpick against the bottom of the jack repeatedly, and was able to pull out several small pieces of what I'll call lint â€“ probably a mixture of dust, fibres and oil.

I plugged it in to the stereo and ta da! No more noises. No more end-play.

Moral

Once again, the simplest solution (though not necessarily the most obvious one) usually is the correct one.

I'm posting this tip because many people have this problem, and most keywords like click, beat, and pop result in pages of results completely unrelated information (thanks Dr. Dre).