Updating an Xcode project

Ran into a fun error today.  I am working on updating a iOS app for a client.  I have a project file from the old developer and while the project builds and runs fine its quite messy. Lots of unused classes and assets.  Its also an old project and rather than go and clean everything up I decided I was going to start with a new clean slate and import only the stuff I needed.

So I created a new project and set the bundle identifier to exactly the same as before. Also kept the display name identical.  It compiled fine. But when I ran it on my phone it installed the app but would crash immediately.   I would also see this error pop up.

“Could not change executable permissions on the application.”

Never seen that before and had no idea what it was.  Did some digging and thought it was just the naming of the app. Or the signing cert was wrong.  I made sure it was all the same except one thing… The .xcodeproj file was named different.  I didn’t think that would cause any issues.  But that was it.

The reason I named it different was the old project was named something generic. With a space. And it wasn’t in the bundleID. The bundle identifier was set manually.  So I named the project something new and tried setting the bundle identifier the same way.

So not only does the display name and Bundle identifier need to be the same. The project file needs to be the same also.

 

Exception breakpoint in Xcode

One of the things that I have been getting hung up on in Xcode is the debugger. It always seems like a bunch of gibberish when an error is thrown.

I have been watching the iTunes-U videos on iOS from Stanford and just watched the video on debugging.  The instructor gave one tip, among others, that turned a light on for me.

Exception breakpoints.  Now I can catch any errors when they occur rather than at the end of the stack. Amazing.

Here is how you can add this sweet little nugget of wisdom.

First open the debug panel on the left.

Then down at the bottom click the plus sign

Now add a new Exception breakpoint.

Then set it to break on all exceptions. 

Now when any error pops up you will be taken to where that error happened rather than main.  That always drove me nuts.