BuySellAds.com

If you like my tutorials, you will love my book . It is chockful of advanced programming techniques and the only comprehensive barcode reference for serious iOS developers.
Our DNA is written in Objective-C
Jump

Category Archive for ‘Recipes’ rss

Travis CI For Pull Request Validation

If you have an project that is accepting code contributions then you will want to make sure that those well-meaning additions don’t break existing functionality. Services like GitHub allow you to review such pull requests via their colored diffs or even give instructions as to how to manually pull the commits into a local branch for evaluating this.

But there is a limit that is quickly being reached if you need to check all those pull requests manually. Even worse, this is a mundane task, usually trying out if the targets build and running the unit tests. Repetitive tasks like this are boring and thus nobody can be faulted for starting to neglect them.

In this blog post I will explain how to set up Travis-CI to have all pull requests be automatically checked for you. You will know for each pull request if merging it into your develop branch would break the build or unit tested functionality.

Read more

Variable-Sized Items in UICollectionView

UICollectionView was added last year with iOS 6 and to this date I had no real chance to get acquainted with it since most of my apps were still supporting iOS 5. Doing a fresh app only supporting the latest iOS version finally allowed me to dig into it and share the journey with you.

The special scenario we want to look at today is how we could configure variable-sized collection view cells for items like tags. We want to have the cells adjust their size automatically based on the tag string and ideally we don’t want to have to write any layout code for determine the needed sizes.

Please forgive if the following has a few places where I stumbled. It is these temporary snags that I believe you learn from the most, so I left them in the final article.

Read more

Block-Based Logging Replacement for NSLog

It became apparent that we should have a standard method for logging in our frameworks. Some of use are happily using Cocoa Lumberjack in product apps, but not everybody might share this test. So there was a need to have some sort of looking hooks in our shared library code. This would allow everybody to hook up his own favorite logging framework or simply use NSLog.

In this blog post I am explaining the rationale behind DTLog, new in DTFoundation as of version 1.5.1.

Read more

Monitoring a Folder with GCD

There is no notification to be gotten if the user adds or removes files to your app’s documents folder. The only way to update your list of files in that case is to monitor the folder for changes. There are several different approaches to achieve this, the traditional one being the File System Events API.

But since iOS 4 – together with GCD – Apple added a simpler method for monitoring a vnode, dispatch sources.

Read more

Talking to Amazon Web Services

I have several boxes of books that I want to create a list of. I have the technology down to scan the book bar codes rapidly. But how could I get the book titles for my inventory?

Amazon Web Services (AWS) is a collection of Amazon’s web APIs. Their Product Advertising API offers to search for books by ISBN and so I had to dig into their documentation to figure out how to query their API.

Read more

Taking Stackshots

You know how to take screenshots on your iOS device and that is quite useful when filing bug reports because as they say “a picture is worth a thousand words”. But there are situations – happened to me recently – when an app is non-responsive and a screen shot wouldn’t really tell much of a story.

Especially when dealing with BETA software it is useful to also commit to memory how to take stackshots.

Read more

Zip Snapshot of GIT Repo

The sample apps I am making to accompany bug reports to Apple I generally create with a GIT repo behind them. I’ve gotten used to Xcode already creating a new repo when I start a new project, so why not make use of the GIT Goodness.

But when it then comes to attaching this project to a Radar I want the ZIP to be a small as possible. GIT provides several methods to achieve that.

Read more

Apple-tab-span

Tab Key

An editor has to deal with the user hitting the tab key on an external keyboard and then be able to persist these tabs. Thus the question arose how I would best represent tab characters (\t) in HTML. At first I tried to encode them as entities, but that is causing lots of trouble since on the parsing end it is difficult to know whether a tab came from this entity or if it came from the literal \t.

I could have done that with a very ugly hack of libxml2 (which powers my DTHTMLParser), but after having wasted half a day on this I relented. I previously reported my findings about Apple-converted-space which is the method NSHTMLWriter uses to preserve multiple spaces.

In this article I am documenting my findings related to how Apple conserves tabs for HTML output.

Read more

WWDC iWatch with Pebble

There will most likely not be an iWatch this year, the Pebble is what comes closest to it. It does have an internal ARM-based CPU and it can communicate with iOS devices over bluetooth. There are two kinds of of things you can build for it: watch faces (which don’t have any interaction) and apps.

For today’s project I want to try to put together a watch face that shows the WWDC 2013 Logo and a countdown to the keynote on Monday, June 10th.

Update June 2nd: I made the UTC offset changeable and released a build of the app via mypebblefaces.com

Read more

Tokenize This!

I have two vendor IDs, one from my time as Individual and the newer one since I changed to a Company developer account. There might be other other reasons for having multiple vendor IDs, if you know of any, please let me know. I’m curious.

Now for this week’s update to AutoIngest for Mac I wanted to turn the plain text Vendor ID field into a token field like the Mac mail app has. Fortunately NSTokenField exists on Mac since 10.4 and today we shall explore its use.

Read more