88fsantos
88fsantos

Reputation: 393

IOS - How to run an app in Background?

I'm developping an app, that one one his tasks, is to send messages in tcp to a server. I want that the app continuos sending that tcp messages, even if the user quits the app.

I've that I could do that with:

"In your Info.plist set LSBackgroundOnly to 1."

But it don't work (I just tested on the simulator).

Thanks a lot for the help!

Upvotes: 0

Views: 717

Answers (1)

Karoly S
Karoly S

Reputation: 3258

I'll just put Holex's comment into answer form to take care of this question. As he states, there are only 3 types of services allowed to run in the background of an application, location services, audio, and VoIP. A great read on what you can and cant do is the following http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html from Apple. Fairly detailed article of the structure of what happens when an application loses focus.

Alternatively however, if you don't plan on releasing through the app store, it is possible to fake a VoIP application and send/receive messages in the background. This is not a legitimate solution however, and really should be used for nothing other than if you need something quick, and extremely dirty.

iOS Voip Socket will not run in background That question, and any related ones are good places to start.

Upvotes: 3

Related Questions