开发者

How to tweet in iPhone when app is closed or in background Process

I am making an application in which i have to show user location url in twitter, i have successfully integrated twitter api and url gets post whenever sign开发者_StackOverflowed in and clicked tweet, however is there any way when user clicks on home button, then in background process url gets updated in twitter, please hep me regarding this issue


The applicationWillResignActive: method will get called if the user hits the home button (or gets interrupted by a phone call, etc)

In that handler you could do a POST to Twitter. I think that would be a small enough task that it wouldn't be disruptive or against the intended use of that method.


Since only certain activities are permitted in the background (location, music, etc)...you'd have to piggyback on one of those...since you're tweeting location it makes sense to use that one, so perhaps you could use signigificant location changes, and tweet on each locationDidUpdate?


You can't post a request in the background every N minutes.

The only thing you can do is have some time when the app goes to the background to finish something you've started, like, say, if you started a download request and the user clicks the Home button, you have some time to finish the request.

One this time is done, your app is sleeping.

But you may register to have a notification that may wake up your app on significant location changes. This should be helpful if your aim is to tweet your position every time you move significantly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜