使用ios4.x我可以使用下面的代码获取"kCTMessageReceivedNotification"通知时的消息
CTTelephonyCenterAddObserver( ct, NULL, callback,NULL,NULL, CFNotificationSuspensionBehaviorHold);
if ([notifyname isEqualToString:@"kCTMessageReceivedNotification"])//receive message
{
NSDictionary *info = (NSDictionary *)userInfo;
CFNumberRef msgID = (CFNumberRef)[info objectForKey:@"kCTMessageIdKey"];
int result;
CFNumberGetValue((CFNumberRef)msgID, kCFNumberSInt32Type, &result);
Class CTMessageCenter = NSClassFromString(@"CTMessageCenter");
id mc = [CTMessageCenter sharedMessageCenter];
id incMsg = [mc incomingMessageWithId: result];}
Run Code Online (Sandbox Code Playgroud)
但是对于ios5我不能这样做因为incMsg是零,所以我该怎么做才能得到消息?
谢谢
我需要实现一个应用程序,用于在 iPhone 上接收或发送短信时检测事件。不需要读取短信。
我的应用程序将使用苹果的 VoIP 和导航器后台多任务功能在后台运行。
我可以使用私有 api,因为我的客户不需要应用商店上的这个应用程序。
谢谢。