-1

UPDATE: I mean when the application has gone to background, the user closed it, iPhone is on the Springboard. Can be the connection kept alive?


I want to push some content to the clients. Is it possible? Do I have to register some... ...thing?

Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
  • 1
    I think you need to add some more detail on what you want to achieve and what you already tried. – Joachim Isaksson Jan 23 '12 at 14:39
  • Bonjour is just a service discovery protocol - what is it that you're *really* trying to do ? – Paul R Jan 23 '12 at 14:40
  • 2
    Duplicate question http://stackoverflow.com/questions/8970651/is-a-bonjour-connection-notifiy-app-in-background-on-received-data-ios – Nick Bull Jan 23 '12 at 14:48
  • The duplicate question has no answer. – Cocoa Dev Jan 23 '12 at 14:49
  • Bonjour is not a "connection". I suggest you research [Bonjour](http://en.wikipedia.org/wiki/Bonjour_(software)) and then ask specific questions relating to that. – Nick Bull Jan 23 '12 at 14:50
  • 3
    @CocoaDev: That's irrelevant, it's the fact that the OP posted two nearly equal questions that's relevant here. – Emil Jan 23 '12 at 15:12
  • Updated the question. Any answer regarding to the question? – Geri Borbás Jan 23 '12 at 15:40
  • Edited. I have an NSNetService connection resolved, and I want it to be responsive even if the device gone sleep. – Geri Borbás Jan 23 '12 at 15:44
  • @Emil: I'm ready to send a third question, If no answers came. I think it is not a question that has no answer. – Geri Borbás Jan 24 '12 at 10:10
  • 1
    @Geri: If you do that you will most likely be banned. I suggest you read the FAQ. – Emil Jan 24 '12 at 10:47
  • @Emil: I've edited the question, and answered, too. – Geri Borbás Jan 24 '12 at 10:58
  • 2
    @Geri - Posting many duplicates will not get you a better answer (it will get you blocked from asking after enough downvotes though...). You should be improving your question, not creating another duplicate - edited questions are bumped on the tag/home pages, they get fresh eyes on them as a result. – Nick Craver Jan 24 '12 at 11:45
  • @Emil: Ye, as it always turns out, if no answer came, the question is bad (or call it uninformed). – Geri Borbás Jan 24 '12 at 12:18

2 Answers2

2

Just register the app as a VoIP app, then a socket will be mantained in the background.

Page 60, and Page 180: http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/iphoneappprogrammingguide.pdf

The actual background task can be subject of App rejection, you have to be careful.

Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
1

http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/

This should be a good start.

You can keep the connection alive for upto 10 minutes

UIBackgroundTaskIdentifier myLongTask;
myLongTask = [[UIApplicationsharedApplication]
          beginBackgroundTaskWithExpirationHandler:^{
              // If you're worried about exceeding 10 minutes, handle it here
          }];
[[UIApplication sharedApplication] endBackgroundTask:myLongTask];

This will give you 10 minutes to check for a connection. After 8 minutes, you can use a local Push notification asking the user to open the app to extend it for another 10 minutes.

Cocoa Dev
  • 9,361
  • 31
  • 109
  • 177