I have an .ipa
which has arm64
and armv
7 slices in it. If I run it on a iDevice which supports both arm64
and armv7
which slice will be picked by the runtime ?
Can I see somewhere by printing NSLog
or some way to understand that runtime has picked slice arm64
?
You could try this way. You will have to add more options of cpu_type_t.
func getCPUType() -> String {
var size: size_t = 0
var type: cpu_type_t = 0
var subtype: cpu_subtype_t = 0
size = MemoryLayout<cpu_type_t>.size;
sysctlbyname("hw.cputype", &type, &size, nil, 0);
size = MemoryLayout<cpu_subtype_t>.size;
sysctlbyname("hw.cpusubtype", &subtype, &size, nil, 0);
// values for cputype and cpusubtype defined in mach/machine.h
var cpu = ""
if (type == CPU_TYPE_X86)
{
cpu += "x86"
} else if (type == CPU_TYPE_VAX) {
cpu += "vax"
} else if (type == CPU_TYPE_ARM) {
cpu += "ARM"
switch(subtype)
{
case CPU_SUBTYPE_ARM_V7:
cpu += "V7"
break;
// ...
default: break
}
}
return cpu
}
Edited: First try with "hw.cpufamily"
sysctlbyname("hw.cpufamily", &type, &size, nil, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With