You can use communication latency to determine which devices are the closest.
Send a message to the other device, record how many milliseconds (nanoseconds?) it took to respond. The quickest response will be the closest device.
Almost all of the communication protocols travel at (approximately) the speed of light. Therefore you can divide the amount of time taken to get a communication response by the speed of light to calculate the distance.
It's not perfectly accurate due performance overhead created by error correction algorithms, but if you perform this measurement many times and calculate an average latency, it will be accurate enough for what you want to do here (the more times you repeat the test, the more accurate it will be).
Note that if your communication is going via some other device, such as a cell phone tower or wifi access point, then you are calculating the distance between that access point and each device, not between your device and the other devices. Keeping this in mind, you may only be able to use protocols like bluetooth or wifi over the personal hotspot feature built into iOS.
EDIT: Another possibility is to play a sound on one device, and listen for that same sound on the other devices. The speed of sound is much slower than the speed of light, so it may work better. I'm not sure how good an iPhone's microphone is though.