Determine if iOS device is 32- or 64-bit

前端 未结 7 579
清歌不尽
清歌不尽 2020-12-01 04:03

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,

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 04:15

    If you are compiling with clang, there is another way: just check if __arm__ or __arm64__ is defined.

    The example code below is not tested but it should illustrate what I mean by that:

    #if defined(__arm__)
        NSLog(@"32-bit App");
    #elif defined(__arm64__)
        NSLog(@"64-bit App");
    #else
        NSLog(@"Not running ARM");
    #endif
    

    Note that this relies on the fact that current iOS application binaries contain both, 32bit and 64bit binaries in a single container and they will be correctly selected depending on whether your app supports executing 64bit.

提交回复
热议问题