BuySellAds.com

Read the chapters in my new book Barcodes with iOS 7 as I hand them in. Great new app opportunities await!
Our DNA is written in Objective-C
Jump

Category Archive for ‘Recipes’ rss

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

Simple Reachability + Blocks

The Reachability sample is arguable the one piece of Apple sample code that is seen in most wide use. But it is just that: a sample.

It was lacking in some regards and so a plethora of variants popped up, all with varying version numbers. But all these version numbers do is to mask the fact that these are not “official” versions of sanctioned Apple code.

Yet another problem is that people needed to start prefixing their versions of Reachability as to avoid conflicts with other people’s Reachability contained in other components.

Read more

Local CocoaPods

Today I learned that besides of using CocoaPods pod specs via the official repo, you can also use local clones of the source code as pods.

Read more

Getting Glyph Paths with DTCoreText

A client wanted to have a method for producing text that has a “cut out” effect, aka Text with “Inner Shadow”. Sort of like if you take a sheet of paper and then cut out the letters, then have light coming from up and slightly to the left so that it throws a shadow into the cut out letters.

For such a scenario you have to get a CGPath that is comprised of the glyphs that make up the text. Those are called glyphs because in some languages they are letters, but in some others they are not. Glyphs are the atomic element that any written language consists of.

Because it reasonably fits with the other work I have already done in DTCoreText I added such a method to both the classes for glyph runs as well as lines. These new methods will be released in the upcoming DTCoreText 1.5 release.

Read more