我一直在使用漂亮的PLCrashReport框架从我的用户的iOS设备向我的服务器发送崩溃报告.
但是,为了表示崩溃报告,symbolicatecrash实用程序请求与iPhone OS版本号一起,我有ipsw的字母数字版本,格式为:
OS Version: iPhone OS 4.0.1 (8A293)
Run Code Online (Sandbox Code Playgroud)
我知道我可以获得iOS的数字版本[[UIDevice currentDevice] systemVersion],但我怎么能得到另一个呢?
我无法找到方法,而且我已经搜遍了我能想到的每一个地方.
Dyl*_*and 29
不知道为什么其他人说这是不可能的,因为它正在使用该sysctl功能.
#import <sys/sysctl.h>
- (NSString *)osVersionBuild {
int mib[2] = {CTL_KERN, KERN_OSVERSION};
u_int namelen = sizeof(mib) / sizeof(mib[0]);
size_t bufferSize = 0;
NSString *osBuildVersion = nil;
// Get the size for the buffer
sysctl(mib, namelen, NULL, &bufferSize, NULL, 0);
u_char buildBuffer[bufferSize];
int result = sysctl(mib, namelen, buildBuffer, &bufferSize, NULL, 0);
if (result >= 0) {
osBuildVersion = [[[NSString alloc] initWithBytes:buildBuffer length:bufferSize encoding:NSUTF8StringEncoding] autorelease];
}
return osBuildVersion;
}
Run Code Online (Sandbox Code Playgroud)
小智 9
你为什么不尝试这个?
NSString *os_version = [[UIDevice currentDevice] systemVersion];
NSLog(@"%@", os_version);
if([[NSNumber numberWithChar:[os_version characterAtIndex:0]] intValue]>=4) {
// ...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12700 次 |
| 最近记录: |