2

有什么方法可以确定 iPhone 是否支持 CDMA 或 GS​​M 网络。任何可以提供此信息的 Objective-C 中的 Apple API。

4

1 回答 1

5

您可以使用函数 ( credits ) 检查模型 ID:

#include <sys/types.h>
#include <sys/sysctl.h>
NSString* machine () {
        size_t size;

            // Set 'oldp' parameter to NULL to get the size of the data
            // returned so we can allocate appropriate amount of space
        sysctlbyname("hw.machine", NULL, &size, NULL, 0); 

            // Allocate the space to store name
        char *name = malloc(size);

            // Get the platform name
        sysctlbyname("hw.machine", name, &size, NULL, 0);

            // Place name into a string
        NSString *machineid = [NSString stringWithUTF8String:name];

            // Done with this
        free(name);

        return machineid;
    }

函数将返回类似 @"iPhone3,3" 的字符串,它代表 iPhone 4 (CDMA/Verizon)。收集各种型号的完整表格可能很困难。一些模型描述可以在这里找到。随着新模型的出现,您必须展开模型表。

于 2011-09-29T10:54:01.910 回答