Closing the loop on Core Recipes

A while back, I had some problems with Apple’s Core Data ‘Core Recipes’ example.

I couldn’t find anything on Google, so I emailed a friend of a friend at Apple, and ended up getting some VERY helpful troubleshooting tips from Matthew Firlik. I asked if I could post them and he said yes, so here we go:

However, I have seen these symptoms in the past when
there was an incongruity between two settings — the “Product Name”
and the CFBundleExecutable for the application. (These values should
be the same, otherwise the Finder gets rather confused.)

Try this:

– Open the CoreRecipes project, and expand the “Targets” group
– Double-click on the “CoreRecipesApp” target to bring up the target
inspector
– Enter “Product Name” in the search field to find the build setting

The value should be “CoreRecipes”. Now, if you click on the
“Properties” tab in the inspector, the executable will also be listed
in the topmost text field — and it should match (“CoreRecipes”). For
good measure, click the “Open Info.plist as File” button at the bottom
of that pane, and inspect the file — you should find the values in
the file as well:

CFBundleExecutable
CoreRecipes

If you build the application, and then go to the Finder and “Show
Package Contents”, you should be able to ensure the information
matches. The values in the “Info.plist” in the Contents directory
should match name of the executable in the Contents/MacOS directory.
A good thing to do is to drag the Info.plist from the build product
onto the Xcode icon (to open it), and then under the “Format” menu
select “Parse as Property List” — that’ll ensure it’s a valid format.

– – – – –

Now, more recent project templates don’t actually put the executable
name into the Info.plist — at least, not directly. They actually put
in:

CFBundleExecutable
${EXECUTABLE_NAME}

and then check the “Expand Build Settings in Info.plist” checkbox in
the build settings for the target. This tells Xcode to process the
Info.plist file at build time and put the correct information into the
property list. If the above didn’t show anything obvious, you might
try changing the setting in the Info.plist and checking the build
setting, to see if that might help.

– – – – –

If things still aren’t working, then a couple of other things to try:

– If you build the application, and then run from the Finder (double-
click) rather than from Xcode, does it work correctly?
– Does a basic Core Data application (built from the stock template
in Xcode) exhibit the same problem?
– If you open the build settings for the application target, is the
“ZeroLink” option enabled? And if so, do things work if you turn it
off?
– If you change the store type in the -setupDefaultStore method in
the AppDelegate class to NSSQLiteStoreType (rather than the XML
store), does it work?

I got partway through the list and my problems with the example went away. I wasn’t as diligent as I should have been tracking which step actually fixed it, but was happy enough it worked!

This entry was posted in General and tagged . Bookmark the permalink.