본문 바로가기

분류 전체보기206

Swift rootView 변경하기. let ad = UIApplication.shared.delegate as! AppDelegate //델리데이트 값 받아오기. ad.window?.rootViewController = self //루트뷰를 현재 메인뷰로 변경 해당 2줄로 간단하게 해결 가능합니다. 2021. 12. 8.
Swift FCM에서 보낸 데이터를 앱 사용중 실시간 파싱 앱을 사용하는 도중 fcm에서 보낸 KEY VALUE 의 값을 계속해서 받아 볼 수 있는 방법. AppDelegate에서 extension AppDelegate : UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter,willPresent notification: UNNotification,withCompletionHandler completionHandler:@escaping(UNNotificationPresentationOptions)-> Void) { let userInfo = notification.request.content.userInfo print(userInfo["gcm.. 2021. 12. 8.
Swift 푸시(FCM) 알림 클릭 시 원하는 웹뷰 페이지로 이동하기 AppDelegate에서 extension AppDelegate : UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter,didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { } } 해당 함수를 사용이 가능 합니다. 해당 함수는 푸시를 클릭 했을 시 호출됩니다. 그리고 이제 웹서버에서 보내준 데이터를 받아야 하는데요. let userInfo = response.notification.request.content.userInfo var link .. 2021. 12. 8.
Swift 로컬에서 Notification(알림) 구현하기. import UserNotifications 우선 이렇게 임포트 하나 해주시구요. let userNotificationCenter = UNUserNotificationCenter.current() 클래스 딴 전역으로 하나 선언해줍니다. func callNotification(seconds: Double, title : String, body : String) { let notificationContent = UNMutableNotificationContent() notificationContent.title = title notificationContent.body = body let trigger = UNTimeIntervalNotificationTrigger(timeInterval: seconds, .. 2021. 12. 6.