0

I have two targets, my main target and my test target that uses OCUnit. Both targets are pointing at a different info.plist in each target build settings. I wanted to add custom info.plist settings to my test target, but once i run the project and call

[[NSBundle mainBundle] objectForInfoDictionaryKey:@"FooKey"];

But it does not find it.

If i try to look for the test target plist it also doesn't find it

NSString *fooPath = [[NSBundle mainBundle]  pathForResource:@"fooInfo" ofType:@"plist"];

Even if i add the info.plist to the "Copy Bundle Resources" in "Build Phases".

Does anyone know how could I have add custom properties to an infoPlist just for tests? I wanted to do this so I wouldn't have to point to a specific File.

Thanks

Edit:

Thanks @aminoacid for your reply, question is duplicated of Why can't code inside unit tests find bundle resources?

which in result for future reference:

 [[NSBundle bundleForClass:[MyTestClass class]] objectForInfoDictionaryKey:@"fooKey"]

will provide the required answer.

Regards

Community
  • 1
  • 1
RicardoDuarte
  • 728
  • 7
  • 23

0 Answers0