In my last couple of posts I’ve talked about the hardware and software behind my birdhouse camera project. I haven’t previously covered how I’m giving it all enough power to operate, and therein lies a tale. No Power? No Problem If I had a power outlet located anywhere near the bird house, this would have been easy. Pretty much any micro-USB power adapter would plug into the…
In my last post I went over the components of the bird house camera I set up this year to get a better look at the local black-capped chickadees. Today I’ll talk about the software that makes it work. Initial Setup Being relatively new to Raspberry Pi, I started off with a full install of Raspbian Deskop. It’s more than I need, since I won’t have anything like a desktop setup,…
My current non-app related project has taken me out into the back yard, but brought along my coding and technical experience. Given this site’s name, the project might be called the atomic birdhouse. For the past couple of years I’ve had a bird house in my yard, in which black-capped chickadees have nested and raised chicks. I’d see them come and go, and sometimes hear sounds…
…or, how to accidentally break Swift initialization rules. Today I’m going to talk about optionals. Swift optionals. And also another kind of optional. And how you might break the ironclad rules of Swift without realizing it until it’s too late. What is an “optional” anyway? It depends who you ask. Swift will give you one answer, but Core Data has other ideas. So…
If you know anything about Core Data, you’re probably aware of Xcode’s built-in model editor. If you’ve used Core Data, you’ve probably spent more time with it than you care to remember. It edits the data model, which then gets compiled to a binary form Core Data can use when your app runs. Conveniently it can also generate some code for you, subclasses of NSManagedObject…
* Base 2 Last week at 360iDev I hosted the 8th edition of Stump 360. Stump is an evening event that, to my surprise as much as anyone else’s, has become a tradition at 360iDev. What is Stump 360? Stump started as an unofficial spin-off of “Stump the Experts” at Apple WWDC, which ran for many years. The two overlapped by a year or two, but WWDC Stump stopped several years ago.
This is the second of two posts following up on my earlier post about backing up and restoring Core Data. My past post covered the difficulty of learning how to use mostly-undocumented framework methods, specifically about a Core Data method called replacePersistentStore(...). Arnaud Joubay recently messaged me to ask why I used a different approach when backing up and restoring persistent stores.…
Last year I wrote about backing up and restoring Core Data. Recently Arnaud Joubay messaged me to ask about it. I used a method called migratePersistentStore(...) to duplicate a persistent store. Arnaud asked why I had not used a similar method called replacePersistentStore(...) instead. He also sent me a link to a post on Apple’s dev forum site, attributed to an anonymous framework…
Today we’re going to travel back in time a little with Core Data. Or at least find out how your app can do so. What if you want to make a backup copy of your app’s data? What if you want to restore from that backup later on? This won’t be mainly about data safety, because your app’s data will be getting backed up to the user’s iCloud account and, maybe, their Mac.
Today I’m continuing with some ideas from my recent post about using PDFKit. In that post I was using a custom PDF view for an app that would work something like a basic slide presentation app. Part of that was adding a thumbnail view with PDFThumbnailView, which ended up looking like this. PDFThumbnailView works with a PDFView and generates thumbnails for pages in the current document. You…
In a previous post I wrote about How JSON compares to Apple property lists and the obstacles to converting data between them. That was a while ago but the post is still accurate, as far as it goes. But Swift changes the situation in some ways, so an update is in order. Recap: JSON vs. Property Lists The previous post was motivated by the problems some people encountered trying to download JSON…
In my post about my custom presentation slide app I mentioned that because of time constraints, I decided against doing my own slide layout. Instead I’d do that in DeckSet, export my slides to PDF, and show the PDFs in my app. So, how do you do that then? Getting a PDF on the screen The basics of PDFKit are actually pretty basic. If you have a PDF, you create a PDFDocument to hold it and a…
This is a story of how a trip to a karaoke bar led to me writing my own app to display presentation slides. Of how a user interface that allows live smartass comments led to me being completely nerd sniped until I was able to do something I’ve never seen in a conference session– however silly the result was. In the end audience members could send Emoji and other images directly to the…
Apple’s developer tools provide a rich variety of debugging aids. Sometimes though, it’s useful to do things the old fashioned way. With debugging, this often means just printing out data while your code runs, and then looking through the results to see what’s going on. Some scenarios where printing debug data helps include: When you need to check on something that happens a lot.…
Aaaaand, I’m back. It’s been a long time since I posted anything here. Mainly this was because I worked full time for a while. I found it hard to work all day on someone else’s project, then come home and do even more blog-worthy code-related stuff. At the end of the work day I was done with code. So, this blog faded away. Back before that, in my glorious years of independence, I…
The Colorado Springs Gazette just did a nice feature article about BombBomb, the place where I write apps these days. The best part (for me) is that the lead photo shows Conor McCluskey (our CEO) showing off an iMessage extension I wrote for the company’s app.
I have a love/hate relationship with regular expressions. I love them because they’re great for examining text to find useful information and, often, to change the text in some way. I hate them because once you get beyond basic matching, they descend into bizarre write-only code that gives me flashbacks to my days writing Perl. In extreme cases they may well endanger the universe. And so we come…
Over the past year or so I’ve been trying out Resilio Sync (formerly BitTorrent Sync) as a possible alternative to Dropbox. It’s gradually improved to where I think I can rely on it. With my Dropbox subscription up for renewal in a couple of weeks, now’s the time. In this post I’ll describe how to set up Resilio to get a Dropbox-like experience. What I want from file…
This post is based on a lightning talk I gave at CocoaConf San Jose a couple of days ago. It’s that time of year– the time when summer time, or “Daylight Saving Time” as we for some reason call it in the USA– is ending. That time when a developer’s thoughts turn to date math and what a pain in the ass it can be. Why is this so hard to get right?
I try to keep this blog on topic, sticking to technical posts of interest to iOS and macOS developers. So when I wanted to write about something else I set up a different blog unrelated to my business. As some of you are aware, when I’m not working on apps I’m also a radio DJ, at KRCC in Colorado Springs, CO. If you aren’t, you might still have noticed how I used to win prizes at…
Later this month I’m hosting Stump 360 III: The Search for Stump, the third annual Stump 360. It’s part of 360iDev in Denver. It’s on August 23, 4:45pm - 6:00pm. In case you’re not familiar with Stump 360, here’s some possibly interesting information. Stump is sort of approximately a game with two teams, the audience and the panel. It’s a quiz/trivia style event…
Here’s the list of questions asked at Stump 360 in 2015. If you’re not familiar with Stump 360, see my other post that describes it more fully In general, Stump 360 questions can cover Anything iOS or Apple related Especially anything covered in a 360iDev talk. Keep in mind the audience is allowed to use Google, etc, so questions shouldn’t be too easy. These are the questions…
One of the cool things UIStackView can do for you is make it easy to dynamically update your app’s user interface while it’s running, with smooth animations and not a lot of code. My recent talk at iOSDevCamp DC covered some techniques. Natasha the Robot wrote a couple of great posts based on my talk, and today I’m going to talk about another unexpected (to me?) use of stack…
As I mentioned in my last post, last week I did a talk at iOSDevCamp DC where I talked about UIStackView, a relatively new UIKit class that’s my new favorite thing in iOS development. I’m going to cover some of the more useful things UIStackView can do in posts here, which will fall more or less into two categories: Simplified and flexible UI design, making common UI patterns easier to…
Last week I did a talk at iOSDevCamp DC, an annual event hosted by Luis de la Rosa. I talked about UIStackView, under the admittedly grandiose title of “Mastering UIStackView”. I’ve used stack views for a number of things recently, as I’ve come to realize they’re a lot more useful than a lot of introductory material might suggest. I’ll be writing about some of…
Just use NSDate, right? The obvious choice for handling dates in iOS and OS X apps is NSDate. It’s obvious, right? It’s got “date” right in its name, doesn’t it? And that’s the thing about NSDate. It’s mis-named. It almost says so right in the docs: NSDate objects encapsulate a single point in time, independent of any particular calendrical system or time…
I wrote a post a few months ago about sharing data between iOS apps and app extensions in which I recommended using NSFileCoordinator and NSFilePresenter. But I had to update the post to remove that portion when some helpful people pointed me to Apple Tech Note 2408, which read in part: When you create a shared container for use by an app extension and its containing app in iOS 8, you are obliged…
A large part of the Swift Standard Library is concerned with Generators, Sequences and Collections and functions that operate on them, so it’s pretty important to have a good understanding of them. I was going to write a blog post about how to create and use Swift generators and sequences. But while I was trying to understand them myself, I found this post over at iOSDeveloperZone. Go read that,…
Over the past month or so I’ve been diving into Swift, after many years of working with Objective-C on Macs and iOS. It’s been a change but, gradually, I’m learning the Swift way of doing things. On the way I’ve run into a few bumps in the road when dealing with Core Data, and I thought would be useful to share how I got past them. Xcode Generated Subclasses Considered…
Since iOS app extensions run as part of a host application rather than as part of their containing app (i.e. your app’s extensions run in somebody else’s app), data sharing isn’t automatic. Finding standard locations like the documents directory doesn’t work for shared data. In this post I’ll go through the details of how to make it all work. Along the way I’ll…
iOSDevCamp Colorado was a couple of weeks ago and I did a presentation/demo on iOS app extensions. I wanted to focus on how to actually do things, so mostly I worked in Xcode rather than present from slides. But rather than paste code in as I went or (gasp!) try to do it live, I worked from a git repository I had built while developing the demo app. Every time I made a significant change,…
Recently I’ve been working on some iOS 8 app extensions, and I’ve run into a few non-obvious details that might come in handy for anyone else in the same situation. Some of the following relates to bugs still in the system, and so will probably only be relevant for a limited time. Debugging: General The intended approach is simple: when you tell Xcode to run the extension, Xcode will…
After my past travails using iCloud with Core Data, I was both interested and concerned when Apple announced CloudKit at WWDC 2014. In this post I’m going to go over what Apple has planned for CloudKit from the perspective of someone wanting to sync app data via some cloud-based means. “Planned” is a key word here, because it’s still to early to say how things work in…
At WWDC 2014 Apple introduced Swift, a new programming language for iOS and OS X developers. Objective-C has had a long and distinguished run with Apple, but times change and we move on. In recognition of this, and in reference to the [objC retain]; shirts of days gone by, I set up a Teespring campaign to say goodbye– gradually– to Objective-C. Why not [objC release];? Swift is the…
My Passbook and iBeacon enabled business card was something of a hit at WWDC last week. Some people wanted more detail on how it worked or how to create their own version. This post describes the process, from the perspective of a software developer. If you’re not a developer, there are numerous web sites that will help compose Passbook passes, but I can’t personally vouch for any. The…
I’ll be in San Francisco during WWDC next week (though without a ticket). This is the only time of year I ever think about business cards, and this year I decided that paper business cards suck and it was time to do something cooler. Instead I’ll have an electronic card distributed via Passbook. Electronic cards are hardly a new idea but (on iOS) they usually depend on both people…
Last year I did a series of posts here where I ran through problems I had encountered with Core Data’s iCloud integration, with various solutions and workarounds I had been able to devise. Then iOS 7 and Mac OS X 10.9 came out with numerous visible (and internal) updates and people started asking me, so, is it any better now? Can we use it? Since then, the answer has been: I have no…
If you’re writing an iOS app and you need to know the user’s current location, the answer is straightforward: use Core Location. That fires up device GPS (when available). Apple’s A-GPS combines this with things like local Wifi networks and IP addresses to work out the device’s location. All of this, of course, assuming that the user allows your app to know their location.…
Over at the Big Nerd Ranch blog, my friend Mark Dalrymple continues his “Inside the Bracket” series with an article on practical uses of Objective-C’s run time introspection. Last time you saw the parts of the Objective-C runtime API that let you query a bunch of the metadata the compiler keeps around once it’s done building your project. Like most discussions of API, it was…
This week was DBX, Dropbox’s first ever developer conference. The big news as far as I’m concerned is their new Datastore API. In a break from their file-oriented past, Dropbox now has an API for syncing structured data between devices. I’ve long been a happy Dropbox user and I’ve lately been a frustrated iCloud developer. So the question is, should I care? Should you? Some…
Learning iPad Programming, 2nd edition, by the excellent Kirby Turner and myself, is finally available. This project has been in the works for a while and now it’s finally actually shipping and in print and stuff instead of just being preorderable. If you order now you can probably have your copy before I get mine. (It’s also available in electronic formats for Kindle and iBooks and as…
In this latest installment of my iCloud series I’ll be taking a look at real world iCloud. Not in the sense of how you should write code to make effective use of iCloud, but in the sense of finding out how people are actually using it in real shipping apps. This was one of my primary purposes in writing momdec, my Core Data model decompiler, and I’ll use it here to see what turns up.
In today’s installment of my continuing series on using iCloud with Core Data I’m going to discuss how factors beyond your control may render iCloud unusable, even if everything is working normally. Even if everything is working correctly, the current API can still require complex workarounds to get decent app performance. Through this, keep in mind that as with my previous post,…
From the README on github: momcom is a command-line tool for Mac OS X that takes an uncompiled Core Data model created with Xcode and compiles it to produce a compiled .mom or .momd suitable for use at run time. Please note that momcom is experimental. Although it is intended to be at least as as functional as compiling a data model using Xcode’s built-in model compiler, it is not mature…
From the README on github: momdec is a command-line tool for Mac OS X that takes a compiled Core Data model and decompiles it to produce an equivalent xcdatamodel or xcdatamodeld suitable for use in Xcode. The resulting model file can also be used with mogenerator to produce source code files for Core Data entities which have custom subclasses. My latest open source project. A compiled managed…
Today I’m continuing my series of iCloud/Core Data-related posts with a discussion of duplicate data, how and why it occurs, and what you can do about it in your apps. As with my previous post in this series, today I’m sticking to how things are supposed to work and sometimes actually do. The problem of duplicate data isn’t actually specific to iCloud. It can happen in any case…
It’s almost time for iOSDevCamp Colorado! iOSDevCamp is an informal un-conference where anyone is welcome and encouraged to present about anything relevant to iOS development. Colorado has a fantastic iOS developer community and these events are a great place to meet people, learn things, and have fun. Three weeks from today! This is the fourth annual event in Colorado Springs. We held the…
As (link:/blog/icloud-sotu text:promised), I’m going to be doing a number posts on using iCloud with Core Data. I’m not sure how many there will be, I’ll keep going as long as it takes. Today I’m starting off with some things that, while not actually bugs, may catch a developer off guard. In this post I’m sticking to how iCloud is designed to work, and not getting…
Update: This post is old but still accurate as far as comparing JSON with property lists, with examples for Objective-C code. If you’re using Swift, see my newer post that updates this one for Codable and Swift examples. Mac OS X and iOS include support for JSON and property lists, two generic structured data formats, both in common use in different places. If Stack Overflow is any…
“Don’t you just turn on iCloud syncing, and it all Just Works?” “Just works” might be the customer experience; but developers must do more to support iCloud (or any new OS technology) than simply flipping a switch. Things can go wrong, and they often do. Rich gets into a lot more technical detail than most of the other iCloud coverage that’s come out recently. I’m way too familiar with…