我有一个包含在具有以下名称的捆绑包中的文件:
databaseX.sqlite
其中 X 是应用程序的版本。如果版本是 2.8,则文件应命名为database2.8.sqlite
. 当应用程序提交给 Apple 时,我必须确保包含此文件。
是否可以创建编译器指令来检查文件是否在包中?
我试过这个,没有成功
#define fileInBundle [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"LoteriaMac%@.sqlite", [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"]]]
#if defined(fileInBundle)
#pragma message("file in bundle")
#else
#pragma message("file missing")
#endif
file in bundle
即使文件不在捆绑包中,也会始终显示。