iPhone, Swift3 에서 푸시 수신을 받은 후, 클릭 시 이동을 할 사용자 ViewController 를 지정할 수 있는지 궁금합니다.
조회수 1918회
안녕하세요.
현재 아이폰에서 푸시 개발을 한 상태입니다.
- 푸시 수신 후, 수신 팝업 메세지 출력
- 수신 팝업 메세지 클릭 시, 사용자가 원하는 viewController로 이동이 가능한지 궁금합니다.
- 클릭 시, 기본은 기본 앱의 메인으로 이동을 하게 되어 있습니다.
- 위 3번으로 이동을 하지만, 중간에 한번 내용을 확인을 하는 ViewController에서 자세한 내용(내용이 긴다든지, 이미지 혹은 파일 첨부 등등)의 내용을 확인(사용자 화면에서 확인) 후,
- 최종(사용자 버튼 클릭)으로 MainViewController로 이동을 하는 규칙입니다.
- 개발환경은 iPhone, Swift, GCM(FCM) 입니다.
// 수신 후, 푸시팝업을 클릭했을때....AppLelegate.swift
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
print("클릭 시, ");
print("::::::::::::::::Userinfo \(response.notification.request.content.userInfo)")
아래 소스는 사용자 화면으로 이동을 할 뷰콘트롤러 (온라인 자료를 찾아보니.....)
MainViewController의 ID는 ID_MainPushpots
ID_ViewPopupPush는 이동을 할 ViewController 입니다.
let mainStoryboardIpad : UIStoryboard =
UIStoryboard(name: "**ID_MainPushpots**", bundle: nil)
let initialViewControlleripad : UIViewController = mainStoryboardIpad.instantiateViewController(withIdentifier: "**ID_ViewPopupPush**") as UIViewController
self.window = UIWindow(frame: UIScreen.mainScreen.bounds)
self.window?.rootViewController = initialViewControlleripad
self.window?.makeKeyAndVisible()
오류가 발생이 됩니다. 근본적으로 되지 않는지, 안드로이드는 쉽게 구현이 가능했는데.... 어떠한 도움에도 감사드립니다.
}
감사합니다.
-
(•́ ✖ •̀)
알 수 없는 사용자 - 〉
댓글 입력