Both ways described here do work for me on iPhone OS 2.0 and a Pwned iPhone ...
i.e. outside the iPhone before uploading it to "/Applications" with scp (using a self-signed code-signing certificate "Code Signer")
... or on the phone with the latest ldid ...
codesign -fs "Code Signer" MyApp.app
ldid -S MyApp
But how do I get Xcode to debug/deploy my application on the phone ? I've specified the "Code Signing Identitiy" in the project settings but it seems i need a "Code Signing Provisioning Profile" too ...
If I build my App and sign it outside Xcode (method 1 described above) and try to upload it with the Organizer, the device reports
unknown afcd <Error>: user mobile has uid 501
unknown afcd <Error>: mode is 0x41e8
unknown securityd <Error>: mobile_installat SecItemCopyMatching: missing entitlement
unknown mobile_installation_proxy <Error>: verify_executable: Could not validate signature: e8008015
unknown mobile_installation_proxy <Error>: preflight_application_install: Could not verify /var/tmp/install_staging.akog/MyApp.app/MyApp
unknown mobile_installation_proxy <Error>: install_application: Could not preflight application install
unknown mobile_installation_proxy <Error>: handle_install: Installation failed
Is it even possible to deploy and run apps to the "~mobile/Applications" with a Pwned iPhone and Xcode / manually ? Applications under "/Applications" do behave differently on the phone.
E.g. the "Settings.bundle" is not used, the Application icon is not automatically modified, you can't delete the application on the phone with the re-arranging function ...