【问题标题】:What's CTSubscriber (and how to use it) on iOS 7?iOS 7 上的 CTSubscriber 是什么(以及如何使用它)?
【发布时间】:2014-01-23 12:14:27
【问题描述】:

在 iOS 7 上,CTSubscriber 被添加到 CoreTelephony 框架中。没有可用的文档,只有它的头文件:

/*
 * 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

另外,What's new on iOS 7 上也提到了这一点:

Core Telephony 框架 (CoreTelephony.framework) 可让您获取有关设备使用的无线电技术类型的信息。 与运营商合作开发的应用还可以针对该运营商的特定订阅者进行身份验证

我认为CTSubscriber 与文本的粗体部分有关。但是,我还没有找到任何与这种情况有关的信息。

我尝试使用以下代码(添加到application:didFinishLaunchingWithOptions:)来试验此 API,但从未触发通知并且carrierToken 返回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);
}];

所以,我有以下问题:

【问题讨论】:

标签: ios objective-c ios7 core-telephony


【解决方案1】:

我在开发者论坛上问了同样的问题,得到了这样的回复:

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

话题链接:https://devforums.apple.com/message/934226#934226

【讨论】:

  • 看来这是有人能得到的更好的答案。以防万一,我会在给予赏金之前稍等片刻。
  • 该链接不再起作用.. 是否有任何文档或示例说明如何更详细地使用它?
【解决方案2】:

您找不到任何文档的原因是,Core Telephony 的大部分内容都包含私有 API。因此,无法从 App Store 上发布的应用程序访问 SIM 卡。当然,越狱设备是另一回事,但在这种情况下,您几乎只能靠自己了。

编辑:

Core Telephony 框架 (CoreTelephony.framework) 让您获得 有关设备使用的无线电技术类型的信息。 与运营商合作开发的应用程序也可以进行身份​​验证 针对该运营商的特定订户。

【讨论】:

  • 那么苹果为什么要公开我提到的方法呢?
  • 我知道。我的问题中提到了。我想知道的是“与运营商合作开发的应用程序如何也可以针对该运营商的特定订阅者进行身份验证”。
猜你喜欢
  • 2011-04-09
  • 1970-01-01
  • 1970-01-01
  • 2013-09-19
  • 2022-01-10
  • 2015-03-13
  • 2013-10-25
  • 2014-11-19
  • 1970-01-01
相关资源
最近更新 更多