NSDataAsset(name:bundle:) only works on the mainBundle().
Originator: | ross.kimes | ||
Number: | rdar://22254994 | Date Originated: | 12-Aug-2015 03:14 PM |
Status: | Open | Resolved: | |
Product: | iOS SDK | Product Version: | iOS 9.0 |
Classification: | Enhancement | Reproducible: | Not Applicable |
Summary: NSDataAsset(name:bundle:) returns nil when run when trying to get data from an Asset Catalog that is not in the mainBundle (for example, an Asset Catalog that is in a Framework). Steps to Reproduce: 1. Create a Framework target. 2. Add an Asset Catalog to that Framework. 3. Add a data set to that Asset Catalog. 4. Try to grab the data using NSDataAsset(name: “name”, bundle: NSBundle(forClass: SOME_CLASS_IN_FRAMEWORK.self)) Expected Results: The NSDataAsset should not be nil. Actual Results: The NSDataAsset is nil. Regression: It fails regardless if you are calling from inside that framework or from the app. The framework *can* grab data from an Asset Bundle in the app using NSDataAsset(name: “name”, bundle: NSBundle.mainBundle()).
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!