Orp*_*rph 6 jailbreak ios core-telephony ios8
我有一个应用程序,我想收到短信时作出反应; 直到iOS 7,这通过注册到CTTelephonyCenter这样工作:
id center = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(center,
NULL,
callback,
NULL,
NULL,
CFNotificationSuspensionBehaviorHold);
Run Code Online (Sandbox Code Playgroud)
并在回调检查kCTMessageReceivedNotification.这在iOS 8中不再起作用,因为我收到的通知类型远少于iOS 7,并且没有与消息接收有关.我认为这是关于一项新的权利,但如果是这样的话,还无法确定,以及所需的权利是多少.有人知道如何解决这个问题吗?
您需要在第四个参数中指定通知名称:
id center = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(center,
NULL,
callback,
CFSTR("kCTMessageReceivedNotification"),
NULL,
CFNotificationSuspensionBehaviorHold);
Run Code Online (Sandbox Code Playgroud)
从iOS 8开始,您无法NULL作为通知名称传递以接收所有CoreTelephony通知.现在您必须确切地告诉它您要观察哪些通知.
8.3更新
从iOS 8.3开始,至少kCTMessageReceivedNotification需要接收权利(可能是所有通知的情况,但不确定)
<key>com.apple.CommCenter.fine-grained</key>
<array>
<string>spi</string>
</array>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1752 次 |
| 最近记录: |