简体   繁体   English

我可以在Iphone的后台将位置发送到服务器吗?

[英]Can I send locations to a server in background on Iphone?

I'm looking for the answer to my question but it's quite difficult for me. 我正在寻找问题的答案,但这对我来说很困难。 I would like to keep connected to the server in background sending location of the iphone with ios4. 我想通过ios4在iPhone的后台发送位置中保持与服务器的连接。

I`m really sad because I think that multitasking of apple is not real multitasking, in fact they only keep the state of the app but they don't allow it to run in background. 我真的很伤心,因为我认为Apple的多任务处理并不是真正的多任务处理,实际上,它们仅保留应用程序的状态,但不允许其在后台运行。

May be somebody knows if is possible to send a call by http every 30 or 60 minutes... 可能有人知道是否可以每30或60分钟通过http发送一次呼叫...

Please, any help would be very appreciated. 请任何帮助将不胜感激。 Thanks in advance 提前致谢

Depends on it you are looking to track the user -- like Grindr does (this is not bad, per se, it just must be disclosed to the user -- and PLEASE remember to power down the GPS equipment if you really do not need to do this at certain times). 取决于您要跟踪的用户-就像Grindr所做的那样(本质上这还不错,它必须向用户披露-如果您确实不需要关闭GPS设备,请记住将其关闭在特定时间执行此操作)。

You are able to register for several different types of "location" registrations, wake up (enough to do something with that information) and wait until the next update. 您可以注册几种不同类型的“位置”注册,唤醒(足以对该信息进行一些操作),然后等待下一次更新。

Look at Multitasking under "Receiving Location Events in the Background". 在“在后台接收位置事件”下查看多任务处理。 It will give you all the info you need. 它会为您提供所需的所有信息。 Short answer: iOS4 may not support what you think you need for this, but it, in fact, does support everything required to do what you are asking. 简短的答案:iOS4可能不支持您认为需要的功能,但实际上,它确实支持完成您所要求的一切。

link text (Membership required) 链接文字 (需要加入会员)

I know this is an old question, but below is a relevant statement from the Core Location documentation regarding background handling of "significant location change": 我知道这是一个老问题,但是以下是“核心位置”文档中有关“重大位置更改”的后台处理的相关声明:

Because your application is in the background, it should do minimal work and avoid any tasks (such as querying the network) that might prevent it from returning before the allocated time expires. 因为您的应用程序在后台,所以它应该做的工作很少,并且避免任何可能阻止其在分配的时间到期之前返回的任务(例如查询网络)。 If it does not, your application may be terminated. 否则,您的应用程序可能会终止。

link to documentation containing quote 链接到包含报价的文档


I'm not sure if the quoted statement is saying to avoid all network "queries", but I think a quick POST of the location should be fine. 我不确定引用的语句是否在说要避免所有网络“查询”,但是我认为对该位置进行快速POST应该很好。

There's a good answer to this question by user RedBlueThing here . 用户RedBlueThing 在这里对这个问题有很好的答案。 The answer is basically yes, you can process network requests, but you might need to ask the OS for more time to accomplish the task. 答案基本上是肯定的,您可以处理网络请求,但是您可能需要询问操作系统更多的时间来完成任务。

I did this but my app got rejected due to this last week. 我这样做了,但由于上周的缘故,我的应用被拒绝了。 I used the ios5 SDK. 我使用了ios5 SDK。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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