Created
April 25, 2018 11:25
-
-
Save zhangkn/f4466ed422c4f08d920671531fdb0006 to your computer and use it in GitHub Desktop.
/获取这个版本的的应用场景:为了区分这个静态库是第三方集成版本,还是自家app的独立版本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MYBUNDLE_NAME @"hecardpackNFCBundle.bundle" | |
#define MYBUNDLE_PATH [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: MYBUNDLE_NAME] | |
#define MYBUNDLE [NSBundle bundleWithPath: MYBUNDLE_PATH] | |
+ (NSString*)appVersionCode{ | |
//获取的版本号 | |
// NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; | |
//取KNStaticBundle.bundle 的版本号与独立版本的版本号保存一致 | |
NSDictionary *infoDictionary = [MYBUNDLE infoDictionary]; | |
NSString *appVersionCode = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; | |
if (appVersionCode.length > 0) { | |
return appVersionCode; | |
}else{ | |
return @"get app version failed!"; | |
} | |
} | |
//获取这个版本的的应用场景:为了区分这个静态库是第三方集成版本,还是自家app的独立版本--- | |
//因为静态库通过有很多使用者,有时可以根据这个bundle target的版本做一些处理 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment