0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

iOSでデュアルSIM情報を取得する

Posted at

SIMの情報を取得しようと今まではこんな感じで、キャリアの名前とか取れてたんですが、

CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netinfo subscriberCellularProvider];
self.carrierLabel.text = carrier.carrierName;

iOS12以降ではデュアルSIMを想定したコードにする必要があります。

NSDictionary<NSString *, CTCarrier *> *dicCarrier =  [[CTTelephonyNetworkInfo new] serviceSubscriberCellularProviders];
for (id key in dicCarrier) {
  NSString *carrierName = [[dicCarrier objectForKey:key] carrierName];
  if ( carrierName ) {
    // 配列に追加
  }
}
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?