Hi ;-)
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
My guess is that since I do not really embeed the framework, but use it from the workspace, xcode messes things up and is not able to properly get the framework's bundle, mbut I may be wrong.
Any help would be appreciated. thanks.