开发者

iOS: How to ascertain the CPU type, e.g. A4 or A5, or instruction set architecture arm6 or arm7?

Does Apple provide an API that gives access to this information?

Does the ARM have 开发者_JS百科an equivalent to the x86 CPUID instruction that I could use in an asm block?

Thanks.


Erica Sadun has written a number of useful queries. I would begin checking out the uidevice extensions code and see if you can find what you are looking for there.

https://github.com/erica/uidevice-extension

Also, as Gapton says, keep in mind that some device queries will not get App Store approval, especially the unpublished ones, but a fair number of them are okay to use.


I need CPU model info and instruction set. So I try to do it as simple as possible:

std::string GetCPUModel()
{
    // you can compare results with https://www.theiphonewiki.com/wiki/List_of_iPhones

    struct utsname systemInfo;
    uname(&systemInfo);

    std::string version(systemInfo.version);

    size_t cpuModelPos = version.find("RELEASE_");

    if (cpuModelPos != String::npos)
    {
        // for example: will return "ARM64_S8000" - for iPhone S6 plus
        return version.substr(cpuModelPos + strlen("RELEASE_"));
    }

    return {};
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜