同步操作将从 兰德网络O2OA平台软件/O2OA 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//// NotificationService.swift// O2PlatformExtPushStatistics//// Created by 刘振兴 on 2018年4月14日.// Copyright © 2018年 zoneland. All rights reserved.//import UserNotifications@available(iOSApplicationExtension 10.0, *)class NotificationService: UNNotificationServiceExtension {var contentHandler: ((UNNotificationContent) -> Void)?var bestAttemptContent: UNMutableNotificationContent?override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {self.contentHandler = contentHandlerbestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)if let bestAttemptContent = bestAttemptContent {// Modify the notification content here...bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"let session = URLSession.sharedlet attachmentPath = self.bestAttemptContent?.userInfo["my-attachment"]if let attachPath = attachmentPath,(attachPath as AnyObject).hasSuffix("png") {let task = session.dataTask(with: URL.init(string: attachPath as! String)!) { (data, response, error) inif let _ = data {let localPath = "\(NSTemporaryDirectory())/myAttachment.png"if NSData(data: data!).write(toFile: localPath, atomically: true) {let attachment = try! UNNotificationAttachment(identifier: "myAttachment", url: URL(fileURLWithPath: localPath), options: nil)self.bestAttemptContent?.attachments = [attachment]}}self.apnsDeliver(request: request)}task.resume()}else{self.apnsDeliver(request: request)}//contentHandler(bestAttemptContent)}}func apnsDeliver(request:UNNotificationRequest){JPushNotificationExtensionService.jpushSetAppkey("")JPushNotificationExtensionService.jpushReceive(request) {print("apns upload success")if let contentHandler = self.contentHandler, let bestAttemptContent = self.bestAttemptContent {contentHandler(bestAttemptContent)}}}override func serviceExtensionTimeWillExpire() {// Called just before the extension will be terminated by the system.// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {contentHandler(bestAttemptContent)}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。