Is there an app, or is it possible to create an app, that can activate an external switch via the charging cable.
Basically I want an app where the iPhone has a countdown and at zero activates a solenoid switch ??
While it can be done, it isn't the easiest way actually. You'd be better off creating a WiFi based switch or a Bluetooth one. Then the app would be almost trivial to write. Using the charging cable requires additional work and the app would have additional restrictions on it. If you had a developers account, and some little knowledge of circuits you could hack together a WiFi based one in a few hours.