add weixinapi

This commit is contained in:
lianxiang
2018-08-27 13:35:39 +08:00
parent a4242fa7b7
commit 6e090fd28d
21 changed files with 325 additions and 58 deletions
@@ -28,25 +28,24 @@
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
content.title = alertAction;
content.body = alertBoday;
content.sound = [UNNotificationSound defaultSound];
//content.sound = [UNNotificationSound defaultSound];
content.sound = [UNNotificationSound soundNamed:@"4481.wav"];
//content.sound = UNNotificationSound
//通知附件 音<10M p3 p4 ,视频<50M pmeg mpeg4 图片<5M
NSURL *imageUrl = [[NSBundle mainBundle] URLForResource:@"MaskTime" withExtension:@"png"];
UNNotificationAttachment *attach = [UNNotificationAttachment attachmentWithIdentifier:@"photo" URL:imageUrl options:nil error:nil];
NSURL *audioUrl = [[NSBundle mainBundle] URLForResource:@"pomodoSound" withExtension:@"m4a"];
NSURL *audioUrl = [[NSBundle mainBundle] URLForResource:@"4481" withExtension:@"wav"];
UNNotificationAttachment *attachAudio = [UNNotificationAttachment attachmentWithIdentifier:@"audio" URL:audioUrl options:nil error:nil];
NSURL *vedioUrl = [[NSBundle mainBundle] URLForResource:@"emojizone" withExtension:@"mp4"];
UNNotificationAttachment *vedioAudio = [UNNotificationAttachment attachmentWithIdentifier:@"vedio" URL:vedioUrl options:nil error:nil];
content.attachments = @[vedioAudio];
content.attachments = @[attachAudio];
//延迟通知 第一个参数是重复的时间间隔,最小60s,第二个参数是是否重复。
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:timeInterval repeats:NO];
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:60 repeats:NO];
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:identifier content:content trigger:trigger];
[center addNotificationRequest:request withCompletionHandler:^(NSError *_Nullable error) {
GILog(@"成功添加推送");
@@ -62,6 +61,7 @@
localNotification.alertAction = alertAction;
localNotification.applicationIconBadgeNumber = 1;
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.soundName = @"4481.wav";
//localNotification.alertLaunchImage = @"MaskTime.png";
localNotification.userInfo = @{identifier:identifier};
//根据设定时间发送通知
@@ -127,6 +127,7 @@ API_AVAILABLE(ios(10.0)){
NSLog(@"iOS10 前台 收到本地通知:{\\\\nbody:%@\\\\ntitle:%@,\\\\nsubtitle:%@,\\\\nbadge%@\\\\nsound%@\\\\nuserInfo%@\\\\n}",body,title,subtitle,badge,sound,userInfo);
[self showAlert:title message:body];
[center removeAllPendingNotificationRequests];
}
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
}
@@ -136,7 +137,7 @@ API_AVAILABLE(ios(10.0)){
API_AVAILABLE(ios(10.0)){
GILog(@"ios10用户点击通知栏相应");
[center removeAllPendingNotificationRequests];
completionHandler();
}
//