靜電
void回調(CFNotificationCenterRef中心,void *觀察者,
CFStringRef名稱,const void *object,CFDictionaryRef userInfo)
{
if([(ns string *)name is equal tostring:kCTMessageReceivedNotification]){
uialertview * alert =[[uialertviewalloc]init with title:@ \ \ \ " Prompt \ \ \ "
留言:@\\\ \ "您有新留言,請查收!\\\ "委托人:零
CancelButtonTitle:@ \ \ \ \ " OK \ \ \ \ \ " otherButtonTitles:nil]];
[警報顯示];
[警報發布];
}
}
2.通知的登記
cttelephonycentraddobserver(CTTelephonyCenterGetDefault()、NULL、callBack、NULL、NULL、cfnotificationsuspensionbehaviorsdrop);
3.運行代碼並嘗試發送壹條短消息。