Testing Background Transfer Service in Suspended State

Hello,


I'm trying to test a simple background download (using NSURLSession with backgroundSessionConfiguration).

There is a sample call SimpleBackgroundTransfer which is usefull but I would like to test this specific api:


- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler


This method is called after iOS automatically relaunches the app, when the app is no longer running.

In the simulator, I can force quit my app but in my comprehension all the background downloads are then stopped, as the app has been quit by an user action. To test application:(UIApplication *)application handleEventsForBackgroundURLSession:, I need to put my app in suspended state but I don't see an obvious way to do this, either in the Simulator or on a device.


Thanks for the help / any advices,


Jc

Accepted Answer

You should read Testing Background Session Code, one of the feature posts over in Core OS > Networking.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thank you very much for your advice, I will try and update my workflow in case anybody need it,


Regards,


Jc

Testing Background Transfer Service in Suspended State
 
 
Q