开发者

Writing iPhone filesystem in background mode

开发者 https://www.devze.com 2023-02-05 12:59 出处:网络
I am writing an app that logs GPS locations to a file on the iPhone and has to continue updating the locations in background mode. Now I am wondering what is the best way of doing this. Is it good pra

I am writing an app that logs GPS locations to a file on the iPhone and has to continue updating the locations in background mode. Now I am wondering what is the best way of doing this. Is it good practice to open the file and ke开发者_高级运维ep it open when my app goes in to background mode or should I close it and re-open it whenever the app needs to write a new location?


Why keeping open/re-opening the file?

You can let it "write" the location data to an NSMutableArray and write it to a file before your App gets killed or if the user manually saves it by pressing a button.

As drachenstern already mentioned, it will suck the battery dry to have location services on all the time...might lead to a bad UX

0

精彩评论

暂无评论...
验证码 换一张
取 消