سؤال

On iOS 7, CTSubscriber was added to the CoreTelephony framework. There is no documentation available, only its header file:

/*
 * CTSubscriberTokenRefreshed
 *
 * Description:
 *     The name of the NSNotification sent when the carrier token is available.
 */
CORETELEPHONY_EXTERN NSString * const CTSubscriberTokenRefreshed  __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_7_0);

CORETELEPHONY_CLASS_AVAILABLE(7_0)
@interface CTSubscriber : NSObject

/*
 * carrierToken
 *
 * Description:
 *     A data blob containing authorization information about the subscriber.
 *
 *     May return nil if no token is available.
 */
@property (nonatomic, readonly, retain) NSData* carrierToken  __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_7_0);

@end

Also, on What's new on iOS 7, this is mentioned:

The Core Telephony framework (CoreTelephony.framework) lets you get information about the type of radio technology in use by the device. Apps developed in conjunction with a carrier can also authenticate against a particular subscriber for that carrier.

I think that CTSubscriber is related to the bold part of the text. However, I haven't found anything related on how this happens.

I have tried to use the following code (added to application:didFinishLaunchingWithOptions:) to experiment with this API, but the notification is never fired and carrierToken returns nil:

CTSubscriber *subscriber =  [CTSubscriberInfo subscriber];
NSLog(@"%@", subscriber.carrierToken);

[[NSNotificationCenter defaultCenter] addObserverForName:CTSubscriberTokenRefreshed object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
    NSLog(@"==========");
    NSLog(@"%@", note);
    NSLog(@"%@", subscriber.carrierToken);
}];

So, I have the following questions:

هل كانت مفيدة؟

المحلول

I asked the same question in the developer forums and got this reply :

You should escalate this via the carrier you're working with, who can in turn escalate it to their contact at Apple.

Link to the thread: https://devforums.apple.com/message/934226#934226

نصائح أخرى

The reason you can’t find any documentation is because much of Core Telephony consists of private APIs. Consequently, there isn’t any way to access the SIM card from an app published on the App Store. A jailbroken device is, of course, another story, but in that case you’re pretty much on your own.

Edit:

The Core Telephony framework (CoreTelephony.framework) lets you get information about the type of radio technology in use by the device. Apps developed in conjunction with a carrier can also authenticate against a particular subscriber for that carrier.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top