inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

todo앱 User Notification에서 질문이 있습니다

미해결

야곰의 iOS 프로그래밍

안녕하세요? todo앱을 new project를 열어서 강의를 따라하다 보니 AppDelegate에서 막혔습니다. if let navigationController: UINavigationController = self .window?.rootViewController as ? UINavigationController, 구문에서 Type of expression is ambiguous without more context라는 에러가 떠서 이런저런 검색을 해보니 iOS 13부터인가 window에 대한 선언이 SceneDelegate.swift에 있다고 func scene( _ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {} 에서 window를 통해 rootViewController를 지정할 수 있다고 알게 되었습니다. 그런데 또 어떤 글은 앱이 완전히 구동하기 전에 User Notification Delegate 설정을 해줘야 한다고 AppDelegate.swift의 func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any ]?) -> Bool {} 에서 delegate 설정을 완료해야 한다고 되어 있어서요. [질문 1] UNUserNotificationCenter.current().delegate = todosTableViewController 구문을 어디에 작성해야 되는지 궁금합니다. SceneDelegate에 있는 var window: UIWindow?를 AppDelegate에 선언을 해서 해결해도 될까요? [질문 2] 또한 UNUserNotification의 delegate는 앱에서 하나만 존재해야 하고 존재할 수 밖에 없는지요? todo앱에서 배운대로 조금씩 변경해 보고 있는데요. todosViewController에서와는 다른 유저 알림을 추가로 구현하고 싶다면 UNUserNotificationCenter.current().delegate = myViewController 이런 식으로 delegate를 해야 할 거 같은데 설정해야 위치가 AppDelegate 또는 SceneDelegate에서 설정해야 한다고 하니 UNUserNotificationCenter.current().delegate는 객체가 아니라 타입 프로퍼티(표현이 맞는 건지 모르겠네요)라서 앱별로 하나만 구현할 수 밖에 없는 건지도 궁금합니다. 강사님 강의 듣고 궁금한 것은 알려주신대로 도큐먼트랑 인터넷 검색해서 찾아보고 있는데 위에서 질문드린 부분들은 잘 못 찾겠어서 질문 드립니다.

  • todo앱
  • swift
  • UserNotification
  • ios
  • window
PKH 댓글 1 좋아요 0 조회수 460

인기 태그

인프런 TOP Writers

주간 인기글