简体   繁体   中英

Contact server on significant location update in iOS

I am using significant location update in my app. I have tested by writing the location updates to file. It is working perfectly fine. But how do I send the location update to the server?

Right now I am doing it this way, in didUpdate function, I am calling a function:

Login* login = [[Login alloc] init]; // Login is subclass of nsobject
[login sendLocUpdate:latLong];

In sendLocUpdate , I am using NSUrlConnection to send the location to server. This is not at all updating the server but it is executing the function that writes the location detail to file properly. Please help me out? Thank you!

You should use the Login object the way it will persist all the time while the networking in a process. The "login" in your function is been destroying after the function run to the end. One possible way is to create it as a singleton instance (shared instance) and it will live all the time the app live.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM