Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle background mode #43

Open
aoopvn opened this issue Feb 7, 2015 · 3 comments
Open

Handle background mode #43

aoopvn opened this issue Feb 7, 2015 · 3 comments

Comments

@aoopvn
Copy link

aoopvn commented Feb 7, 2015

How do we handle new event when the app enter background mode?
Here under is my approach for this, but it still doesn't work
Thank you very much for your suggestion

// on app delegate
- (void)applicationDidEnterBackground:(UIApplication *)application {
    [self.sharedSocket on:kMESSAGE callback:^(SIOParameterArray *args) {
           NSLog(@"it does work in here too!");          
    }];
}
// on other controller
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
[SIOSocket socketWithHost:kHOST_URL response:^(SIOSocket *socket) {
      appDelegate.sharedSocket = socket;
      self.mySocket = socket;
      [self.mySocket on:kMESSAGE callback:^(SIOParameterArray *args) {
            NSLog(@"it works!");
      }];
      //other logic code
}];
@ahallora
Copy link

I'm having a similar issue with emits not working when the app goes in background mode. The log shows that the emit function has been called but the callback is not triggered and the log goes quiet. - Until I open the app again, that is. Then the log floods with error messages from siosocket with the error: "type = TransportError;".

Could be related to #36 and #16 ...

Anyone got an idea for a fix? 😄

@zulkis
Copy link
Contributor

zulkis commented Feb 14, 2015

You could try background tasks iOS7+ feature or 'simulate' geolocation activity to simulate 'background work'.

@josefrm
Copy link

josefrm commented Mar 19, 2015

Background task means the app got killed by task manager (mean double tapping and removing form active app)?

Cuz im searching an answer to it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants