completion handler called after release/end
| Originator: | borissotillos | ||
| Number: | rdar://24150970 | Date Originated: | 12-Jan-2016 |
| Status: | will not fix | Resolved: | |
| Product: | tvOS SDK | Product Version: | 9.1 (13U95) |
| Classification: | Reproducible: | 100% |
Boris Sotillos 12-Jan-2016 06:56 PM Summary: After calling the NSBundleResourceRequest::endAccessingResources (and/or NSBundleResourceRequest::release), the finished block(s) of NSBundleResourceRequest::beginAccessingResourcesWithCompletionHandler and NSBundleResourceRequest::conditionallyBeginAccessingResourcesWithCompletionHandler are still being called. I would expect that after indicating that I'm no longer interested (endAccessingResources), I would get no further notifications. After running the demo application we get the log: 2016-01-12 16:50:40.397 crappy[1024:2661604] 1 2016-01-12 16:50:40.401 crappy[1024:2661604] 2 2016-01-12 16:50:40.412 crappy[1024:2661630] conditionallyBeginAccessingResourcesWithCompletionHandler downloadRequired = 1 2016-01-12 16:50:41.402 crappy[1024:2661604] 3 2016-01-12 16:50:41.402 crappy[1024:2661604] 4 downloadRequired = 1 2016-01-12 16:50:41.404 crappy[1024:2661604] 6 2016-01-12 16:50:41.404 crappy[1024:2661604] 8 2016-01-12 16:50:41.405 crappy[1024:2661604] 9 2016-01-12 16:51:16.180 crappy[1024:2661630] beginAccessingResourcesWithCompletionHandler 2016-01-12 16:51:21.406 crappy[1024:2661604] 10 Note how "beginAccessingResourcesWithCompletionHandler" is logged after "9" (which is after endAccessingResources and off the release pool). Steps to Reproduce: I have attached am xcode project Expected Results: I would expect that after indicating that I'm no longer interested (endAccessingResources), I would get no further notifications. Actual Results: completion handler is called after endAccessingResources or release Version: 9.1 (13U95) Notes: Configuration: apple tv using LAN Attachments: 'crappy_offScope.zip' was successfully uploaded. ===================================================================================================================================== Apple Developer Relations 21-Jan-2016 10:37 PM There are no plans to address this based on the following: From the documentation, calling endAccessingResources before you’ve gotten a callback from the begin does not work. * Informs the system that you are finished with the resources that were part of the tag set in this request. Call this after you no longer need the resources to be available on disk. It is important to invoke this method to make room for newly requested resources. This method may only be invoked if you have received a callback from -beginAccessingResourcesWithCompletionHandler:. To cancel an in-progress request, invoke cancel on the -progress property. */ - (void)endAccessingResources; We are now closing this report. If you have questions about the resolution, or if this is still a critical issue for you, then please update your bug report with that information. ===================================================================================================================================== Boris Sotillos 22-Jan-2016 09:33 AM (For completeness on the explanation) The documentation paragraph quoted regarding endAccessingResources is not in the online Framework Reference, but from the framework's header file NSBundle.h ===================================================================================================================================== Boris Sotillos 28-Jan-2016 04:27 PM Retested with tvOS 9.2 beta 2 (12Y5189e), compiled on Xcode 7.3 beta (7D129n) Same behaviour.
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!
=====================================================================================================================================
Apple Developer Relations 04-Mar-2016 09:48 PM
The documentation has been updated. Please verify here:
https://developer.apple.com/library/prerelease/ios/documentation/Foundation/Reference/NSBundleResourceRequest_Class/index.html#//apple_ref/doc/uid/TP40015084 https://developer.apple.com/library/prerelease/ios/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/index.html#//apple_ref/doc/uid/TP40015083