Does anyone know of an easy way to tell if an iOS7 device has 32- or 64-bit hardware? I don't mean programmatically, I just mean via settings, model number, 3rd-party app, etc.
I'm having a problem that I suspect is 64-bit related. Apple's advice is to test on the 64-bit simulator but also on an actual 64-bit device, but then doesn't say anything about how to determine that. I can write a test app to check sizeof(int) or whatever, but there's got to be some way for, say, tech support to know what they're working with.
Eric
Go to the Apple Menu and select "About this Mac". If you have a Core Duo processor, you have a 32-bit CPU. Otherwise (Core 2 Duo, Xeon, i3, i5, i7, anything else), you have a 64-bit CPU.
There is no other "official" way to determine it. You can determine it using this code:
if (sizeof(void*) == 4) { NSLog(@"32-bit App"); } else if (sizeof(void*) == 8) { NSLog(@"64-bit App"); }
Below is the method is64bitHardware. It returns YES if the hardware is a 64-bit hardware and works on a real iOS device and in an iOS Simulator. Here is source.
#include <mach/mach.h> + (BOOL) is64bitHardware { #if __LP64__ // The app has been compiled for 64-bit intel and runs as 64-bit intel return YES; #endif // Use some static variables to avoid performing the tasks several times. static BOOL sHardwareChecked = NO; static BOOL sIs64bitHardware = NO; if(!sHardwareChecked) { sHardwareChecked = YES; #if TARGET_IPHONE_SIMULATOR // The app was compiled as 32-bit for the iOS Simulator. // We check if the Simulator is a 32-bit or 64-bit simulator using the function is64bitSimulator() // See http://blog.timac.org/?p=886 sIs64bitHardware = is64bitSimulator(); #else // The app runs on a real iOS device: ask the kernel for the host info. struct host_basic_info host_basic_info; unsigned int count; kern_return_t returnValue = host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count); if(returnValue != KERN_SUCCESS) { sIs64bitHardware = NO; } sIs64bitHardware = (host_basic_info.cpu_type == CPU_TYPE_ARM64); #endif // TARGET_IPHONE_SIMULATOR } return sIs64bitHardware; }
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