LoginSignup
66
68

More than 5 years have passed since last update.

iOSデバイスから端末情報を取得する

Last updated at Posted at 2014-02-03

iOSデバイスから端末情報を取得する

キャリア情報

キャリア情報取得
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>

    CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
    CTCarrier *carrier = [netinfo subscriberCellularProvider];
    NSLog(@"carrierName:%@",carrier.carrierName);
    NSLog(@"carrierName: %@", carrier.carrierName);
    NSLog(@"mobileCountryCode: %@", carrier.mobileCountryCode);
    NSLog(@"mobileNetworkCode: %@", carrier.mobileNetworkCode);
    NSLog(@"isoCountryCode: %@", carrier.isoCountryCode);
    NSLog(@"allowsVOIP: %hhd", carrier.allowsVOIP);
carrierName: ソフトバンクモバイル
mobileCountryCode: 440
mobileNetworkCode: 20
isoCountryCode: jp
allowsVOIP: 1

キャリア情報はSIMから取得しているものと思われます。
参考:https://groups.google.com/forum/#!msg/iphone-developer-japan/NTFcsA311v8/_rlQotuXBLYJ

OSバージョン

OSバージョン取得
    NSLog(@"systemVersion: %@", [UIDevice currentDevice].systemVersion);
systemVersion: 6.0.1

モデル名

モデル名取得
    NSLog(@"model: %@", [UIDevice currentDevice].model);
model: iPhone

プラットフォーム

プラットフォーム取得
#include <sys/types.h>
#include <sys/sysctl.h>

    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *machine = malloc(size);
    sysctlbyname("hw.machine", machine, &size, NULL, 0);
    NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];
    free(machine);
platform: iPhone5,2
66
68
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
66
68