iPhone が CDMA または GSM ネットワークをサポートしているかどうかを確認する方法はありますか。この情報を提供できる Objective-C の Apple API。
5686 次
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;
}
関数は、iPhone 4 (CDMA/Verizon) を表す @"iPhone3,3" のような文字列を返します。さまざまな型番の完全な表を集めるのは難しいかもしれません。モデルの説明の一部はここにあります。新しいモデルが表示されるので、モデルの表を展開する必要があります。
于 2011-09-29T10:54:01.910 に答える