Commit 6426bfa1 by zhangyunjie

添加本地通知

parent 7bd09de4
......@@ -26,6 +26,18 @@
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UILocalNotification *backgroudMsg = [[UILocalNotification alloc] init];
if (backgroudMsg) {
backgroudMsg.timeZone = [NSTimeZone defaultTimeZone];
backgroudMsg.alertBody = @"VoIP来电";
backgroudMsg.alertAction = @"查看";
NSDictionary *infoDic = [NSDictionary dictionaryWithObject:@"name" forKey:@"key"];
backgroudMsg.userInfo = infoDic;
[[UIApplication sharedApplication] presentLocalNotificationNow:backgroudMsg];
//[self cerateAVAudioPlayer];
}
});
//中公直播使用测试环境设置为YES,正式环境设置为NO或者去掉这个配置
......@@ -159,6 +171,17 @@
NSString *message = [[userInfo objectForKey:@"aps"]objectForKey:@"alert"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:message delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alert show];
UILocalNotification *backgroudMsg = [[UILocalNotification alloc] init];
if (backgroudMsg) {
backgroudMsg.timeZone = [NSTimeZone defaultTimeZone];
backgroudMsg.alertBody = @"VoIP来电";
backgroudMsg.alertAction = @"查看";
NSDictionary *infoDic = [NSDictionary dictionaryWithObject:@"name" forKey:@"key"];
backgroudMsg.userInfo = infoDic;
[[UIApplication sharedApplication] presentLocalNotificationNow:backgroudMsg];
//[self cerateAVAudioPlayer];
}
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment