During the free fall the iphone is supposed to send acceleration values as 0 on all the three axis. So how to detect the distance covered by the iphone?
Ignoring air drag:
float t; // time since drop
float distance = 9.81f * 0.5f * t * t;
For greater distance (drop from airplane) you also could use the location services. CLLocation contains an altitude.
distance = 0.5 * gravityAcceleration * timeOfFall2
In the simplest form.
We can safely omit air friction and wind, given iPhone's form factor and weight as well as the distances which hardware will still be useful when falling from. ;)
However, if you're going with the phone into a free fall before opening a parachute, there are too many factors to count in to reliably calculate the distance, based on accelerometer itself. It is probably not suited for such applications anyway, as the readings are very unstable and its main purpose is to determine device's orientation or detect a potential free fall (in case of notebooks where similar accelerometer chips are used).
If your accelerometers are reporting zero, then you have the problem of determining when your motion has completed.
So determine the deceleration upon impact, then determine the maximum speed at the beginning of deceleration, then work backwards from this. Assuming linear movement, the absence of terminal velocity and air resistance, linear deceleration (perhaps), and that your phone still works!
From a standing start
distance = 0.5 x acceleration x time2
Gravitational acceleration = 9.81 m/s2
I'm going to assume you're not dropping the phone far enough to reach terminal velocity. If you do, I doubt your app will be of much use when you recover the phone :)
This is very simplistic, because you have to account for air friction. Air friction causes the device to reach "a" terminal velocity. Only at terminal velocity will the accellerometer indicate 0.
The formulas given here assume a free fall in a void (no friction).
In other words, it's pretty complicated to calculate the distance travelled (one problem is that terminal velocity depends on the orientation of the phone while falling).
The most simple and naive implementation is to sample the accelerometerdata and use the following formula.
v+=a*dt;
d+=v*dt;
But this is can give drift over time, read this for explanation why and a better solution: http://gafferongames.com/game-physics/integration-basics/
One solution that would take into account the issue of wind resistance is you could use the difference between acceleration from gravity and your actual norm of acceleration you're reading,
d2x / dt2 = g - |a|
Where g = 9.8 and |a| = sqrt(a12 + a22 + a32) where an are the readings from the accellerometer on each axis.
Then solve the differential equation numerically, with something like Euler's Method.
You could even be clever and lookup local value of g using GPS.
The accelerometer will read 0 (or g) on all 3 axis whether it is in freefall or sitting on a table. Therefore the question is moot, since there is no way to determine the distance without making the assumption of freefall.
Do not trust Newton laws, they ignore air drag, Iphone rotation etc. Use empirical approach instead. Let the device fall from several heights like 1m, 2m, 5m, 10m, 30m... Repeat several times for each height. In each fall measure time. Approximate results by spline. Compute inverse function.
Also keep in mind that the phone is VERY likely to be tumbling in any sort of falling scenario. As the phone's profile changes, the drag will change, and the accelerometer will NOT be reading zero.