There are m开发者_JAVA技巧any apps on Appstore which can show you the location of your friend at that moment if your friend and you have the same app running on iPhone.
I would like to know, how can it be done?
Thanks!
The app will need to have a server component. In these types of app, each person's phone connects to the same web service and reports their respective location. The server then sends the location of a user's friends (or potentially anybody else using the app, actually...privacy is a big concern with this type of app) back to that user's phone.
So at the very least, the app will need to use Core Location to get the user'S position and NSURLConnection (or some equivalent networking framework) to send that data to a server and to get other user's positions.
Then, of course, there is the server-side part of the program, which receives locations from users, stores them, and sends them to other users.
Basically, have a cloud service. Your location tracking app in iPhone constantly sends back updates to your service. When you know someone is a friend of someone (maybe through Facebook Connect) you can inform them of their location.
I have shown you a very high level picture. There are a lot more finer intricate details here. Please ask what you need...
精彩评论