
UILocalNotification 通知
小手一背爱谁谁
这个作者很懒,什么都没留下…
展开
-
iOS 模拟器推送
Users/mac/Desktop/push.apns是文件的保存路径。文件保存为**.apns比如push.apns。xcode11以后可以在模拟器上测试接收通知。替换为项目的Bundleidentifier。就可以收到推送消息了。原创 2022-07-29 11:36:29 · 823 阅读 · 1 评论 -
iOS 本地推送通知
/*** 本地推送通知*/- (void)postNoteMessage { // 初始化本地通知对象 UILocalNotification *notification = [[UILocalNotification alloc] init]; if (notification) { // 设置通知的提醒时间 N原创 2016-02-24 15:08:53 · 382 阅读 · 0 评论 -
iOS通知传值
//发送通知页面方法-(void)sendMessage { NSString *servicerefresh = @"yes"; NSDictionary *dict =[[NSDictionary alloc] initWithObjectsAndKeys:servicerefresh,@"key",nil]; //创建通知 NSNotificati原创 2015-12-25 11:06:43 · 539 阅读 · 1 评论 -
iOS 接收新消息通知调用系统声音 震动
添加系统框架:#import AudioToolbox/AudioToolbox.h>调用震动代码:AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);2.消息声音2.1 系统声音AudioServicesPlaySystemSound(1007);其中1007是系统声音的编号,其他的可用编号: iphone原创 2016-03-10 13:41:08 · 9113 阅读 · 0 评论 -
OS 通知播放本地自定义声音
VIewControl中:- (IBAction)click:(id)sender { UILocalNotification *notification = [[UILocalNotification alloc] init]; NSDate *pushDate = [NSDate dateWithTimeIntervalSinceNow:timeField.原创 2016-03-10 14:02:14 · 783 阅读 · 0 评论 -
iOS 自定义通知声音
由于自定义通知声音还是由 iOS 系统来播放的,所以对音频数据格式有限制,可以是如下四种之一:Linear PCMMA4 (IMA/ADPCM)µLawaLaw对应音频文件格式是 aiff,wav,caf 文件,文件也必须放到 app 的mainBundle 目录中。自定义通知声音的播放时间必须在 30s 内,如果超过这个限制,则将用系统默认通知声音替代。可以使用 afco原创 2016-03-10 14:04:44 · 2557 阅读 · 0 评论 -
iOS 在视图控制器里面判断 应用程序的前台
/增加监听[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appHasGoneInForeground:) name:UIApplicati原创 2016-04-22 16:07:16 · 397 阅读 · 0 评论 -
iOS 通知监听
//通知监听 NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(setMyBadge) name:@"receiveMsg" object:nil];//收到通知执行事件-(void)setM原创 2016-04-22 15:54:29 · 661 阅读 · 0 评论 -
iOS 接收通知宏
/* 发通知 */#define sendNotification(name,obj) [[NSNotificationCenter defaultCenter] postNotificationName:name object:obj];//pod 'ReactiveCocoa', '2.5'#import "ReactiveCocoa.h"/* RAC收通知免移除 */#define...原创 2018-05-22 10:12:07 · 657 阅读 · 0 评论