I know that the system can close Bonjour sockets while the application is suspended. But ,will the system allow me while my application is in the background to only discover other devices not creating sockets to them and perhaps store those devices in a list or something like that ?
Asked
Active
Viewed 735 times
2 Answers
1
Use UIApplication
's method
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void (^)(void))handler
you can run your code in background up to 600 seconds on iOS 4.x and later versions.

Andrey Zverev
- 4,409
- 1
- 28
- 34
0
Your app can only run in background for audio, voip or location. So there is no way other then the previous mentioned methods to run an app in the background.

rckoenes
- 69,092
- 8
- 134
- 166
-
What happens if you try ? Exception is thrown ? – Jessy85 Apr 12 '11 at 13:37
-
Your app get rejected by Apple. And you can't us NSTimer in the background. – rckoenes Apr 12 '11 at 13:46
-
I apologize for my lack of knowledge , how does Apple know what I do in my threads , I read in the doc that I can react to server notifications , I will put it on this notification ... – Jessy85 Apr 12 '11 at 14:00
-
Well, you are not allowed (read able) to run threads in the background on an iOS device. If you do you will have placed background mode support key in your info.plist to tell the system what kind of background mode your app requires. If your app than does not match the mode you app will be rejected. – rckoenes Apr 12 '11 at 14:04
-
But if I try to perform discovery after server notification : from whats new in ios 4- "•Push notifications - Receive alerts from your remote servers even when your app isn't running. " then it suppose to work right ? I simply , before I code all that stuff want to have a solid theoritical base by someone with expirience , thank you very much for your kind help ! – Jessy85 Apr 12 '11 at 14:31
-
When using notifications your app will only be able to handle them if the user click ok on the notification request. – rckoenes Apr 12 '11 at 14:32