Danny의 iOS 컨닝페이퍼
article thumbnail
반응형

1. 시작

간단히, App Settings에 접근하는 코드를 알아 봅시다.

<swift>
private func presentAppSettingsAlert() { let alertController = UIAlertController( title: "위치 접근 요청", message: "위치 정보를 얻을 수 없습니다. 위치 권한을 '항상 허용'으로 변경해 주세요.", preferredStyle: .alert ) let action = UIAlertAction( title: "설정창 이동", style: .default, handler: goToAppSettings ) alertController.addAction(action) self.present(alertController, animated: true) } private func goToAppSettings(_ sender: UIAlertAction) { guard let settingURL = URL(string: UIApplication.openSettingsURLString) else { return } if UIApplication.shared.canOpenURL(settingURL) { UIApplication.shared.open(settingURL) } }
반응형
profile

Danny의 iOS 컨닝페이퍼

@Danny's iOS

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!