开发者

iPhone background tasks (AIM application example)

开发者 https://www.devze.com 2023-02-15 20:08 出处:网络
I recently took a look at the AIM application while trying to figure out the best way to handle background updates. An interesting feature that the AIM application has is the ability for the user to s

I recently took a look at the AIM application while trying to figure out the best way to handle background updates. An interesting feature that the AIM application has is the ability for the user to set the time interval upon which the user would be logged out of AIM after putting the application in the background. Does anyone know how this works or how this could be implemented in a similar manner?

It seems that it would be natural to use a NSTimer/Local notification, however this would display a notification when the time (say 5 minutes) is reached after the user puts the 开发者_如何学Pythonapplication in the background. With the AIM application, there is no notification and it seems like they somehow bypass the entire notification system.

Thanks in advance


Most likely, this is implemented in AIM's servers and not in the iOS app. When closed, the app notifies the servers that it has been disconnected. The servers would start a timer for the account. If the user receives a message before that timer completes, the server sends a push notification to the user's device. If the app is reopened, it connects to the server, which then stops the timer. If the app is not reopened before the timer fires, then the server logs the user out.

0

精彩评论

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