Background NSURLSessions ignore the allowsCellular setting on NSMutableURLRequests
| Originator: | padraig.kennedy | ||
| Number: | rdar://15356374 | Date Originated: | 30 October 2013 |
| Status: | Closed | Resolved: | |
| Product: | iOS SDK | Product Version: | 7.0.3 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: An NSURLSession configured with backgroundSessionConfiguration ignores the allowsCellularAccess setting on an NSMutableURLRequest. It will start and continue a download task over cellular even if allowsCellularAccess is set to NO on the request. I have attached a demo project that illustrates this issue. This is not the behaviour documented here: xcdoc://ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/Platform-SpecificNetworkingTechnologies/Platform-SpecificNetworkingTechnologies.html which recommends "At the Foundation layer, you can use the setAllowsCellularAccess: method on NSMutableURLRequest to specify whether a request can be sent over a cellular connection. You can also use the allowsCellularAccess to check the current value." Steps to Reproduce: 1. Create an NSURLSession configured with backgroundSessionConfiguration. 2. Create an NSMutableURLRequest and set its allowsCellularAccess property to NO 3. While connected to a cellular network (not wifi) initiate a download request using that NSMutableURLRequest against the background session. Expected Results: The download should fail since we're on cellular and have set allowsCellularAccess = NO Actual Results: The download proceeds using cellular data despite allowsCellularAccess = NO being no on the request. Version: Xcode 5.0.1, iOS 7.0.3
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
We believe this issue has been addressed. Please verify with iOS 8 beta (Build 12A4265u) release, and reply back with your results.
iOS 8 beta (Build 12A4265u) https://developer.apple.com/devcenter/ios/index.action Posted Date: June 2, 2014
If this issue is still occurring, please include any relevant logs, and or a test case with your update.
Logging Instructions/Test Case Requirements: https://developer.apple.com/bug-reporting/ios/