Xcode and the iPhone development environment has it’s share of cryptic error messages. I encountered the one in the headline the other day.
I was working on an app that has been in development for many months and attempting to deploy the app to a device for testing. I’ve done countless times in the past, but this time Xcode simply said:
(gdb) run Running… Error launching remote program: security policy error. The program being debugged is not being run.
Opening the Organizer window and checking the device log revealed this:
error: unable to launch the application with CFBundleIdentifier 'com.foo.bar' sbs_error = 9
A security policy error is usually associated with your development certificate or provisioning profile. And these have a tendency to expire at the most inopportune times. But that was not the case this time.
However it turned out that in addition to the valid provisioning profile, this device also had an old, recently expired provisioning profile installed. This was apparently too much for the device. After removing the old provisioning profile, everything started working again.
So now you know one reason why your development devices keep reminding you about expiring provisioning profiles. It’s important that you remove them when they expire.