I’m developing an iOS application and I need to make a server call when the home button is pressed… I’ve been reading about and I know there are a couple of methods that are called when the user press that button but I’m really not sure if the app has enought time to make that call…
Here is where I was thinking in adding the server call…
- (void)applicationDidEnterBackground:(UIApplication *)application{
}
Do I have enough time to make the call? Is just a message, I don’t need reply or anything like that…
If it’s not possible what do you think is the best option to make this work? Any idea?
Thanks!
Whatever you put in that method will be executed as soon as the application goes to the background. Why don’t you test it? Don’t you have a way of knowing that the request was sent to the server?
Since there’s nothing you need to do upon server’s response, including the code for making the request in the app delegate’s method you mentioned should do what you’re after.