adhoc app installation failed in iPhone , why?

It appears that the device on which your friend is trying to install your app is not able to validate the application's signature. Basically this means that the provisioning profile you sent to your friend does not match the actual signature (if any) applied when compiling for ad hoc distribution. Try checking the following:

  1. verify that you added a correct Entitlements.plist file to your application.
  2. verify that you added the Entitlements.plist file to your Ad Hoc settings for building the app.
  3. verify that the certificate you are using to sign the application (in your Ad Hoc settings) actually is valid for ad hoc distribution.
  4. verify that you actually built the application using a base sdk related to the device, not the simulator and the Ad Hoc distribution settings.
  5. verify that the provisioning profile you sent is meant for ad hoc distribution and that it includes correctly the device of your friend.

Looks as though your provisioning profile is duff in some way. Here's now I normally work around the problem:

  1. Delete your whole build folder. Clean All should do this for you but does seem to leave bits behind from time to time
  2. Check the device ID in the Developer Center. Edit it if you need to.
  3. Download the profile again.
  4. Install the profile again.
  5. Quit Xcode and reload.
  6. Make sure you've set Xcode to use the new, ad hoc profile rather than your developer profile, for the Code Signing Identity of the configuration you will be using for the archive.
  7. Build
  8. Take a copy of the executable straight away

It would be neat if there was some way of finding which step went wrong, but until that happens it's usually best just to start from scratch unless you have very patient (or local) testers.