I'm migrating my team's app to use NSURLSession instead NSURLConnection's because of the numerous now-deprecated APIs in the NSURLConnection family of classes and protocols. As part of that, we need to decide how often the app should be creating a new session vs. reusing sessions that exist.Based on Apple's documentation, WWDC videos and common sense, it's not a great idea to create a new session for each new URL request. Sadly, Apple's documentation doesn't say whether there would be adverse effects of doing this w.r.t memory, CPU or something else.Based on my application's needs, which include performing work both when the app is foregrounded and when it's backgrounded, I could in theory have only as few sessions in the app as there are different session configurations. The caveat would be that non-background sessions will probably have to be canceled when the app enters the background, and re-initialized when it enters the foreground.Are you aware of any best practices or recommendations for when an app should create a new session vs reuse existing ones? I know the standard answer would be it's app-specific, so maybe a better question is when is it not advisable to create a new session?
When should an iOS app create a new NSURLSession vs. reusing an existing one?
ios;mobile