问题描述
在WWDC 2015会话703隐私和您的应用程序之后,使用 sysctl
进行了更改。现在我们将无法再调用 kern.proc
, kern.procargs
, kern.procargs2
并查看来自任何其他进程的数据,然后查看自己的数据。这是一个非常合法的隐私硬化Apple。
Following WWDC 2015 session "703 Privacy and Your App", there is changes using sysctl
. And now there we will no longer be able to call kern.proc
, kern.procargs
, kern.procargs2
and see data from any other processes then one's self. It's a quite legit privacy hardening by Apple.
任何人都可以确认使用 hw.machine sysctlbyname(...)
/ code>在iOS9中允许获取确切的设备名称并且不受上述限制的影响?
Can anyone confirm that calling sysctlbyname(...)
with hw.machine
to fetch exact device name is allowed in iOS9 and not affected by restriction mentioned above?
推荐答案
是,我在iPhone5中测试了它使用Xcode7 beta5(安装了iOS9 beta5,而不是模拟器)。
Yes,I have tested it Using Xcode7 beta5 in iPhone5(iOS9 beta5 installed,not simulator).
+(NSString *) getDeviceModel {
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *model = malloc(size);
sysctlbyname("hw.machine", model, &size, NULL, 0);
NSString *deviceModel = [NSString stringWithCString:model encoding:NSUTF8StringEncoding];
free(model);
return deviceModel;
}
返回值为iPhone5,2。所以我认为该设备名称不受sysctl函数限制的影响。
And the returning value is "iPhone5,2".So I thought the device name is not affected by restriction on the "sysctl" function.
这篇关于调用“sysctlbyname(...)”与“hw.machine”相关联iOS9中的标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!