Attention: This page contains partner and advertising links. Therefore this page is to be understood entirety as an advertisement!
The idea that OSX automatically opens an application when a iPhone is plugged in is basically not that bad. But it is very annoying when you have to deal with a lot of different iOS devices every day.
Even worse is in my case, that I deleted my iPhoto library some time ago. This causes iPhoto to start and crash immediately with a annoying and focus-grabbing error message that produces a loud "Bunk" that scares the shit out of me for every key I accidentally press to the focussed dialog window.
You can define the action that runs when a iPhone or iPad is connected a cable with the "ImageCapture" app. Just wait for your device to connect and selected from the list on the left side. After this, a small drop down to select the action appears in the upper left corner.
The last step you have to do is to select "No application". From this point, no action is executed or application is started when your iPhone or iPad is connected. As you can see in my screenshots, its not necessary to unlock your device to make this settings take place.