I have a static library associated with the application. The library code opens a file that is in a package that is in a set of applications, opening is performed as:
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"Config" ofType:@"plist"];
This works fine.
However, I want to add some unit test code to the library, and therefore I have a logical test object for it. Since the file is in the bundle for the application, and not in the package for the static library, I copied the Config.plist file and added it to the target test code using Copy Bundle Resources . However, when I execute the test code, the file cannot be found. Why is this?
In that the above is confusing, here is a brief description of the structure of the workspace.
Workspace contains: Application Project with application target, which contains (X) Config.plist (a) Library project which contains: Library target, which contains: the code opening the file in the bundle (b) Test library target, which contains: (Y) A Copy of the Config.plist (c)
So, if I build X, then when b starts, it will find a. But when I build Y, when it works, b cannot find c.
source share