현지 알림으로 작업 중이며 특정 viewController
을 표시하려고하지만이 포럼에서 찾은 내용을 시도했으며 표시된보기와 비정상적인 동작이 나타납니다.알림 작업에서 특정보기 컨트롤러 제공
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping() -> Void) {
print("didReceive Method called")
if response.actionIdentifier == "actionOne" {
DispatchQueue.main.async(execute: {
self.notificationAction1()
})
} else if response.actionIdentifier == "actionTwo" {
DispatchQueue.main.async(execute: {
self.notificationAction2()
})
} else if response.actionIdentifier == "actionThree" {
}
completionHandler()
}
func notificationAction1() {
redirectToVC()
}
func redirectToVC() {
let toVC = VersesViewController()
if self.window != nil && self.window?.rootViewController != nil {
let rootVC = self.window?.rootViewController!
if rootVC is UINavigationController {
(rootVC as! UINavigationController).pushViewController(toVC, animated: true)
} else {
rootVC?.present(toVC, animated: true, completion: {
//Do something
})
}
}
}
코드 (특히 redirectToVC()
방법)에 어떤 문제가 여기 this picture here: 그리고에 AppDelegate.swift의 소스 코드는? 도움이 될 것입니다.
현재 작동합니까? – Mannopson
소스 코드 위에있는 그림을 보면,보기 컨트롤러는 비어있는 상태입니다. –