Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

People Nearby-App

Hello, I want to build an app that displays people nearby (who are using the app) with their profile (photo etc). There are various examples on the market of this kind of apps. However, i just want to build one by myself to see how everything works. I know that for location purposes i should use CoreLocation Framework.But what is next? How is this app going to actually detect the people nearby? If anyone can give me any direction where to start and what steps to follow i would be really grateful. Thank you!

1 Answer

Michael Hulet
Michael Hulet
47,912 Points

It depends on what you define as "Nearby". If by that you mean "within a couple miles", I'd have the user's device get its location and report it to a backend server of yours (if you're not familiar with how to code those, I'd use something like Parse or Firebase), and each user's device would then ask the database periodically what other devices are nearby and display the results

If by "Nearby" you mean "within a few feet (300 or so, approximately)", one of the cool parts of the CoreLocation Framework is that I believe you can leverage it to turn each user's device into an iBeacon. With iBeacons, of course, you can see how far away other iBeacons are, as well as any nearby iOS devices. This gives you a great way of getting all the nearby users without the need for a reliable internet connection.

I would implement one or the other, or if you want to go the extra mile, some combination of the 2

Hi Michael,

Thank you for your answer... By nearby i mean people who are in the range of few meters away and maximum 500 meters away

Michael Hulet
Michael Hulet
47,912 Points

In that case, I think the iBeacon method would be the way I'd go

isnt ibeacon limited to 50 meteres?

Michael Hulet
Michael Hulet
47,912 Points

I'm not sure of the exact limitation. I haven't tried implementing it before. If you'd like to go longer than what it allows, I'd use the first method I suggested, and use the second one for close-range interaction