Home » iphone » Iphone Dev: Welcome to Xcode errors!

Fundamental Website Setup Links

Iphone Dev: Welcome to Xcode errors!

I wanted to relate an interesting issue I recently ran into using Xcode tools for iPhone development. Using iPhone SDK version 3.1.2 and Xcode 3.2.1 on Snow Leopard I ran into a weird crash issue. One of the new functions (and exclusive to Snow Leopard) is the “Rename Project” function in Xcode. Basically it’s normally a bitch to do this manually. Xcode places your project name all over the place in your app, so it’s a very likely situation that you’ll forget to change one somewhere and cause your app to crash or go crazy. So when they added the rename function it was a great relief to many programmers. In our case we use the function to make a new version of our “Central” app for usage by another webcomic in our Webcomic Central service.

Well, in short, the rename function was failing. After trying to do a rename Xcode would crash with an error– Internal error NSCFArray insertObject:atindex attempt to insert nil .

Yeah, not very helpful. The error seems to imply that something somewhere is being renamed but with nothing to input, or with something that’s nil already. So now I’m paranoid about our app. Did we make a mistake somewhere? Is there a cul-de-sac area of the program that doesn’t cause it to crash but is now showing an error when renamed? UGH!

I tried everything I could to find the issue, but it eluded me.

Then it struck me. Did any other apps rename properly? NOPE!

The rename function itself seemed screwed up. So I reinstalled Xcode. It still didn’t work!

What the hell? What do I do now? Then I started thinking. What’s the most basic thing that can go wrong in OS X? Yes, permissions issues.

So I moved the app out of the default applications folder in Xcode and moved it to the desktop. Guess what…it now worked to rename it!

All I can think is that at some point down the line something got screwed up with the permissions for the Xcode folders. It looks like a file with the xproj folder called foo.pbxuser didn’t have permissions to be rewritten with the renaming. So it failed.

Oh, BTW, when the rename failed it deleted the original xproj file for the app….so again with all things, always make a backup of your files before trying to do anything like this.

Anyway, I hope this helps anyone else who might have this issue.

AWSOM Powered