iphone - IOS background work -
i have iphone application facebook iphone. application must connect server , read message every 2 hours regularly. have thread read message when application terminated thread cannot work. can thread run undependently main delegate or how can find solution problem?
you cannot have app stuff in background. there api finish tasks uploading photo killed after around 10 minutes.
but apple push notification service seems appropriate solution problem. server notifies device there new happening , fetch actual messages when user opens app.
edit: of ios 7 apple implemented feature can schedule running tasks fetch data in background. tasks not guaranteed run @ specific times. see release notes ios 7 , linked methods below:
apps regularly update content contacting server can register system , launched periodically retrieve content in background. register, include uibackgroundmodes key fetch value in app’s info.plist file. then, when app launched, call setminimumbackgroundfetchinterval: method determine how receives update messages. finally, must implement application:performfetchwithcompletionhandler: method in app delegate.
Comments
Post a Comment