About "SIMInserted" API

I am using the SIMInserted API on Xcode 16 beta. However, when I checked with a SIM card inserted, it returned "No".

[Enviroment]

Xcode:16beta iOS:18beta1,18beta2

[The modified implementation area is as follows]

1.Add "CarrierDescriptors" to the plist.

<key>CarrierDescriptors</key>
   <array>
      <dict>
         <key>MCC</key>
         <string>440</string>
         <key>MNC</key>
         <string>10</string>
      </dict>
   </array>

2.Add "SIM Inserted for Wireless Carriers" to the capabilities.

<key>com.apple.developer.coretelephony.sim-inserted</key>
	<true/>

3.In case of iOS 18 and above, perform SIM detection using "isSIMInserted" of CTSubscriber.

- (BOOL)isSIMInseted {
    if(@available(iOS 18.0,*)){
        CTSubscriber* ctSubscriber = [CTSubscriber new];
        return = ctSubscriber.isSIMInserted;
    }
    return NO;
}

Is there any mistake in the implementation steps you provided? Why is it not possible to retrieve the desired information with this implementation?

Please assistant me.

I have the same problem. Also iOS 17's CTSubscriber.simInserted() has stopped working in iOS 18. So forwards compatibility has been broken (apps released using CTSubscriber.simInserted() no longer work).

I’m not super familiar with this new API but, historically, it didn’t make sense to construct CTSubscriber values yourself. Rather, you should get them from the subscribers property of CTSubscriberInfo.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@yusuke-murata i dont understand why we need to mention MCC and MNC in info.plist? is there any document showing this? I am using this following code, same it always returning No SIM card detected. my environment as follows, xcode Version 16.0 beta 3 (16A5202i) iOS: 18.0 (22A5307i) beta 3

  // check iOS 18
        if #available(iOS 18.0, *) {
            let subscriber = CTSubscriber()
            do {
                if subscriber.isSIMInserted {
                    return "SIM card is inserted."
                } else {
                    return "No SIM card detected."
                }
            } catch {
                return "Error determining if SIM is inserted: \. 
(error.localizedDescription)"   
            }
}

isSIMInserted is broken and doesn't work with beta 1 and beta 2, you need to use beta 3. And the subscribers should be obtained via CTSubscriberInfo.subscribers() .

i dont understand why we need to mention MCC and MNC in info.plist?

Because the new API is focused on the needs of folks building an app for a cellular carrier, and they know what cellular network is relevant to them.

is there any document showing this?

Not that I’ve seen. Please do file a bug against docs about that, and post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

About "SIMInserted" API
 
 
Q