我在我的应用程序中使用本地推送通知.当在iOS 10中为通知添加操作按钮时,它不会出现在通知下方.通知正在显示,但通知底部缺少操作按钮.appdelegate代码如下.
import UIKit
import CoreData
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) {(accepted, error) in
if !accepted {
print("Notification access denied.")
}
}
let action = UNNotificationAction(identifier: "markCompleted", title: "Mark as Completed", options: [])
let category = UNNotificationCategory(identifier: "todoList", actions: [action], intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([category])
return true
}
func applicationWillResignActive(_ application: UIApplication) …Run Code Online (Sandbox Code Playgroud)