Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's CTSubscriber (and how to use it) on iOS 7?

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:

  • What exactly ("authorization information") does carrierToken return and how to make it not nil?
  • How does Apple know if your app is "developed in conjunction with a carrier"?
  • Is this how Evernote is giving 1 year of premium account to Telefonica users (http://blog.evernote.com/blog/2013/08/13/evernote-and-telefonica-announce-global-partnership/)? (Probably not, since the information they need can be obtained on CTCarrier)
like image 682
Marcelo Fabri Avatar asked Jan 06 '14 06:01

Marcelo Fabri


1 Answers

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

like image 63
Petter Avatar answered Oct 04 '22 04:10

Petter