안녕하세요 Gons 입니다. 오늘은 푸시 알림 권한 요청을 해보겠습니다. 권한 요청 매서드를 작성해주세요. func requestNotificationPermission(){ UNUserNotificationCenter.current().requestAuthorization(options: [.alert,.sound,.badge], completionHandler: {didAllow,Error in if didAllow { print("Push: 권한 허용") } else { print("Push: 권한 거부") } }) } 이렇게 작성하면 권한을 요청하고 리퀘스트를 받을 수 있습니다. viewDidLoad 에서 실행해보겠습니다. override func viewDidLoad() { super.viewD..
안녕하세요 Gons 입니다. 오늘은 위치 사용 권한 요청하는 방법을 알아보겠습니다. 먼저 Info.plist 에 GPS 키를 써주세요. Privacy - Location Always and When In Use Usage Description Privacy - Location When In Use Usage Description Value 에는 알림창에서 보여줄 메시지를 적어주세요. 이제 코드에서 작성할게요. 위치매니저 변수를 하나 만들어주세요. var locationManager:CLLocationManager! 이제 원하는 부분에서 권한을 요청하시면됩니다. locationManager.requestWhenInUseAuthorization() 그러면 아까 Info.plist 에 작성했던 메시지와 함께 ..