)
I develop a framwork along with a testApp that both belongs to the same workspace.
I added a file to my framework, it is in the Copy Ressources part of the Build Phases, I double checked the name, no issues here. I want to load this file using pretty straightforward code using [NSBundle bundleForClass: [self class]] as follows
NSBundle *bundle = [NSBundle bundleForClass: [self class]];
NSString *jsonPath = [bundle pathForResource:@"deviceSafeAreas" ofType:nil];
It always returns nil. The strange part is that if I print the bundlePath iVar, I get the same path for both [NSBundle mainBundle] and [NSBundle bundleForClass: [self class]]. I even tried to "force" the [self class] into [MyClass class], but I get the same result. If I inspect the derivedData, the file is present at the root of the framework
This folder is inside ~/Library/Developer/Xcode/DerivedData/XXXXXX/Build/Products/Debug-iphonesimulator
I also tried to create a bundle folder and add my file to it. Still the same issue : the bundle is in the framework folder, but the path is wrong.
The framework is set as "do not embeed". If I choose Embeed, I can access it through the Framework directory, but it's not a fix since our framework is available through cocoapods and not embeeded in the projects :-/
Any help would be appreciated. thanks.