lundi 9 mai 2016

I can't get BundleVersionKey, BundleIdentiferKey in UnitTest

I develop a framework for iOS apps. I have an unit-test case for testing to get the bundleIdentiferKey, bundleVersionKey.

When I ran the test, It is always failed because Bundle Key is nil.

my logic for getting Bundle ID is below.

 NSString * package = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleIdentifierKey];


 NSString * version = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];

I found that those are nil only if the unit test case in my framework source, But Not in my sample app.

I think It's not a problem because UnitTest Target also has a bundle Identifier, bundle version in info.plist

I don't know how I can resolve this problem. Thank you.

Aucun commentaire:

Enregistrer un commentaire