NSManagedObject

I’ve been discovering the intricacies of managing NSManagedObjects. These are the objects that you as a developer have to use when developing with Core Data. Because of the level of control over the lifecycle of the objects that Core Data takes, the normal -(id)init; and -(void)dealloc; methods should not be overridden in a subclass of NSManagedObject.

Instead, you need to use the NSEntityDescription class method


+ (id)insertNewObjectForEntityForName:(NSString *)entityName

inManagedObjectContext:(NSManagedObjectContext *)context;


This method returns a NSManagedObject of the type noted by the entityName parameter.

While dealing with all this stuff. I realized I don’t understand all the in’s and out’s of how the model creates objects. I had the model backwards, as the one Channel contains many Items, but the model reversed that, so I had to pull some hackery to get what I want.

One little key, if you modify the model, you’ll have to delete the files in ~/Library/Application Support/iPhone Simulator/<version>/Applications/. I deleted everything in there and it was happy again.

At this point, I’m getting data into the model, and that’s good enough for now. I still need to deal with new vs. existing entries, but that’s for another time. It’s now time to move on to the RootViewController and start displaying the data available.

Posted in iOS, Objective-C, Sound Church, XCode | Tagged , , | Leave a comment

NSXMLParser initWithContentsOfURL:

In digging around looking at errors I was getting with the NSXMLParser when using the

- (id)initWithData: (NSData *)data;


initializer, I discovered the


- (id)initWithContentsOfURL: (NSURL *)url;


initializer. This initializer handles all the connection logic without me having to deal with it. Since the reality of this application is, if you can’t download the data from the server, you can still use the app with data that you’ve downloaded previously, there’s no need for me to maintain the downloading separately.

I’m no longer using the RSSDownloader class, or the RSSDownloaderDelegate protocol. Since the only other case of downloading is to get the audio file for a specific message, I probably don’t need the abstraction of moving the download logic to a separate controller class. That, however, is an issue for another time.

Posted in iOS, Objective-C, Sound Church, XCode | Tagged , , | Leave a comment

Sound Church

I’ve been working on the Sound Church application between interviews and phone calls since I’m no longer employed by Point Inside. The app is coming along.

I have a class, RSSDownloader, that implements the NSURLConnection protocol. It also has a delegate that handles the output, providing a bit of abstraction for the connections. When the application launches, the downloader will download the xml file from the RSS feed server and parse it. Then when the user wants to listen to a podcast, that podcast needs to be downloaded, so the RSSDownloader will be used again.

I’m currently working on the parser, which parses the xml file into the required objects. Currently it’s failing on the title of the Channel object. In the current data definition, the channel contains the data that’s part of the RSS header. It contains a list of Items, each item being a separate podcast.

I’d do a screenshot of the data model, but Xcode 4 seems to spread the model out over more than one screen, even though there’s only two entities, and I can’t seem to figure out how to move them closer together, or if it’s possible.

Posted in iOS | Leave a comment

OCMock for iPhone

Thinking about using OCMock with my Sound-Church project. First off, getting it to build is a challenge, particularly to include the library with the version running on the phone. The solution to that problem is with the linker settings.

Linker flags

Notice the -ObjC -all_load flags. Those are required to load a static library, as the dynamic nature of Objective-C makes it not load those libraries.

I’m still figuring out how to use a fake method with multiple parameters with this tool, however. The available documentation is a bit light. I did find this post, which is about the best I’ve found for using OCMock. Nobody describes using OCMock with Xcode 4, however.

Posted in iOS, Sound Church, XCode | Tagged , | Leave a comment

The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store.

I’ve been getting this error today when attempting to build my Sound-Church application. Couldn’t figure it out until I found this post that explained it.

For iOS, look in ~/Library/Application Support/iPhone Simulator/ where version is the iOS version you are targeting to find the offending files. I just blew away all the sub-folders in that folder to solve my problem.

Posted in iOS, XCode | Tagged , , | Leave a comment

New website

If you’re here, you’ve noticed the revamping of this website, with the blog front and center. I will say more about the reasons soon. In the meantime, enjoy the new site.

Posted in Business, Software Development, The Web | Tagged , | 1 Comment

MacBook Pro and Apple Service

I had an opportunity to experience the famous Apple http://www.apple.com/support/ this week. Fortunately, I have AppleCare. It’s worth it.

On Tuesday evening, my MacBook Pro started acting up, in that I could not get it restart. It hung for a long time with a spinning gear, then would come up with the universal deny symbol (the circle with the line through it).

When it still didn’t work Wednesday morning, I called Apple Tech support, and after spending about an hour troubleshooting options to identify the issue, he concluded that it was a hardware problem, and we’d have to send it in for repair. The nearest Apple Store to Yuma is in Palm Desert CA, about 161 miles away.


View Larger Map

The support person told me to expect a week to turn the computer around.

But here’s where it gets good.

  • I’d called Wednesday morning.
  • The box arrived via FedEx Thursday morning.
  • We boxed up the computer and sent it back Thursday afternoon.
  • Friday morning, the Apple repair center received the computer.
  • Friday evening they had completed the repairs and shipped it back.
  • Saturday, mid-day, the repaired computer arrived back at our place.

So overall, it was less than four days, from my calling support to having my computer back, working, and all at no cost to me.

Technorati Tags:
, , ,

Posted in Apple | 4 Comments

Open vs. Closed

Mobile Venture Beat has a piece where a group of VCs discuss open vs. closed, specifically related to mobile, where I’m currently employed.

I’ve also seen a number of discussions on Eric Raymond‘s blog, Armed and Dangerous, about his feelings on the Android vs. iPhone. Being the chief apologist for Open Source, Eric feels that ultimately, Android, built on an open source stack, will win over iPhone, with Apple’s tight control. His latest is here.

Be sure and read, at least scan, the comments in these posts, as sometimes they are more entertaining, and occasionally more insightful than the original article.

I spent a number of years using Linux as my primary desktop. I found it to be stable and reliable. But any time I had to add a new application or upgrade an application, I found myself in no man’s land. Sometimes it worked like clockwork. Other times, I found myself on an upgrade hell, trying to find all the packages necessary to make the new or upgraded application work. I got tired of spending the time making the machine work, instead of using it. For some people, that’s the fun, for me, it wasn’t.

By that time, Mac OS X had established itself as a viable contender, so I switched back, and haven’t looked back since. I do believe that Linux is usually the right answer on the server, however. On the desktop, I need something that I can count on.

So where am I going with all this? Well, I think that neither all open, nor all closed are the right answer. A business has to do what’s necessary to be profitable.

Turns out that at least by some measures, Apple is more open than Google. In fact, Google Chrome is based on WebKit, an Apple open source project.

And Google is more closed than people realize. Nobody knows what Google’s algorithm for pagerank is, let alone seen the code for it. Google’s two sources of income are search and advertising, which they hold very close to the vest.

Apple and Google both give away things that help drive business to their primary revenue sources. In Apple’s case, it’s their hardware. In Google’s case, it’s their search and advertising.

In the long run, there will continue to be both open and closed technologies. And that’s the way it should be.

Update: John Gruber has this post today on Daring Fireball. He discusses the Android vs. iPhone, and the all-out war that has broken out between Apple and Google. Both companies emphasize what they do best and what the other does poorly.

The other interesting thing here is the other actors in the smart phone market. Specifically, Microsoft, who seems to have lost completely in the mobile space.

Technorati Tags:
, , , ,

Posted in Android, Apple, Business, Google, iPhone, OS X, Software Development | Leave a comment

Are we Arrogant?

Seth Godin wrote today about arrogance.

Better, I think, to make a difference and run the risk of failing sometimes, of being made fun of, and yes, appearing arrogant. It’s far better than the alternative.

If we are to make a difference, we have to take risks, including the risk of sounding arrogant at times.

Technorati Tags:

Posted in Business, Personal | Leave a comment

Carrying Capacity

Seth Godin has an excellent post discussing the natural limits of a business, and how we need to think about those limits as we work to grow it.

One side comment in that post relates to the carrying capacity of the planet, along with a comment on population limits.

The earth has a carrying capacity, certainly. It might change as a result of technology (we know how to grow food more efficiently than we did a century ago) but in any moment of time, there’s a limit beyond which degradation kicks in. I don’t think many would say that we currently have a people shortage. (Impossible to pull off, but worth considering: what if we skipped a growth cycle in the population and everyone in a generation had just two kids? Or even one…)

China has been trying the one child per family for some time now, even using draconian measures to enforce it, and now they’re faced with the problem of not enough young people to support their aging population.

I’ve also been told that every man, woman and child on the planet could have an eighth of an acre in the state of Texas, and leave the rest of the world blank. Not suggesting that that is something to do, or that an eighth of an acre is enough to live on, but it does illustrate the real size of the population. We don’t really suffer from too many people, just too many people in some crowded areas.

Technorati Tags:
, ,

Posted in Economics, Politics | Leave a comment