I have an app where I want to react when a SMS is received; up until iOS 7 this worked by registering to CTTelephonyCenter like this:
id center = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(center,
NULL,
callback,
NULL,
NULL,
CFNotificationSuspensionBehaviorHold);
and in the callback checking for kCTMessageReceivedNotification. This does not work in iOS 8 anymore, as I receive far less notification types than on iOS 7, and none related to message receiving. I assume this is about a new entitlement, but could not figure yet if so, and what is the entitlement needed. Does anybody know how to solve this?
You need to specify notification name in fourth argument:
id center = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(center,
NULL,
callback,
CFSTR("kCTMessageReceivedNotification"),
NULL,
CFNotificationSuspensionBehaviorHold);
As of iOS 8 you can't pass NULL
as notification name to recieve all CoreTelephony notifications. Now you must tell it exactly which notifications you want to observe.
8.3 UPDATE
As of iOS 8.3 at least kCTMessageReceivedNotification
requires entitlement to be received (probably the case for all notifications but don't know for sure)
<key>com.apple.CommCenter.fine-grained</key>
<array>
<string>spi</string>
</array>
Since iOS 8.3, the CTTelephonyCenterAddObserver don't work any more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With