Objective-C version of serviceSubscriberCellularProvidersDidUpdateNotifier for iOS12+?

295 views Asked by At

There is this link however it leaves out the iOS 12+ Objective C method. Here's what I have attempted:

Added to the application delegate:

@property (strong, nonatomic) CTTelephonyNetworkInfo *telephonyInfo;

Then in

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...

    self.telephonyInfo = [[CTTelephonyNetworkInfo alloc] init];

    self.telephonyInfo.serviceSubscriberCellularProvidersDidUpdateNotifier = ^(NSString *entry) {
        dispatch_async(dispatch_get_main_queue(), ^{
            qDebug() << "User did change SIM" << entry;
        });
    };
    ...
}

But the code never gets executed (by breakpoint or log message) when I remove the SIM. How can i get the notifications in Obj-C in iOS 12+?

0

There are 0 answers