如何动态获取ios工程的Bundle version版本号,bundleID,appName

发布时间:2025-12-09 14:42:13 浏览次数:5

获取 bundle version版本号

+(NSString) getLocalAppVersion

{

return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];

}

获取BundleID

+(NSString) getBundleID

{

return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];

}

获取app的名字

+(NSString) getAppName

{

NSString appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];

NSMutableString mutableAppName = [NSMutableString stringWithString:appName];

}

1、在桌面最下角点击苹果手机桌面的系统“设置”。

2、常用系统设置请点击“通用”。在第三个模块第一项。

3、找到第一项,点击“关于本机”。系统配置,序列号,版本号型号等等都在此处。

4、在版本一栏可看到 *** 作系统对应的版本编号。如此部手机的ios版本号是:8xx。为最新版。

通过官方的API 可以获取到wifi的信息,实现代码:

1234567891011- (id)fetchSSIDInfo { NSArray ifs = (__bridge_transfer id)CNCopySupportedInterfaces(); NSLog(@"Supported interfaces: %@", ifs); id info = nil; for (NSString ifnam in ifs) { info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam); NSLog(@"%@ => %@", ifnam, info); if (info && [info count]) { break; } } return info; }

至于开关wifi,是一个用户的 *** 作, 在非越狱的机器上,第三方的应用是没法实现这功能的。

非常简单的一句代码:

//version 版本号#define VERSION [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"]

就可以获取了。

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477