If there is a server side involved in your app, you can get the coordinates of every device using CLLocationManager Class and then calculate the distance using following function.
#define d2r (M_PI / 180.0)
+(float) haversine_km:(float)lat1: (float)long1: (float)lat2: (float)long2
{
float dlong = (long2 - long1) * d2r;
float dlat = (lat2 - lat1) * d2r;
float a = pow(sin(dlat/2.0), 2) + cos(lat1*d2r) * cos(lat2*d2r) * pow(sin(dlong/2.0), 2);
float c = 2 * atan2(sqrt(a), sqrt(1-a));
float d = 6367 * c;
return d;
}
Where lat1, long1 are the coordinates of first device and lat2, long2 are the coordinates of other device. The result will be in Kilometers and off course you can convert it to your desired unit. Then you can check if it is within your desired range.