jak uzyskać wiadomość po otrzymaniu powiadomienia „kCTMessageReceivedNotification” na IOS5
Z ios4.x mogę użyć kodu poniżej, aby otrzymać wiadomość, gdy otrzymasz powiadomienie „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];}
Ale z ios5 nie mogę tego zrobić, ponieważ incMsg jest zerowe, więc co mogę zrobić, aby otrzymać wiadomość?
Dzięki