Skip to content

Commit

Permalink
Fix: 위치 권한 요청 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffoio committed Nov 4, 2021
1 parent cae2be8 commit d100d3f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Escaper/Escaper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,14 @@
DEVELOPMENT_TEAM = B3PWYBKFUK;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Escaper/Info.plist;
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "현재위치를 확인하기 위해 권한이 필요합니다.(필수권한)";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "현재위치를 확인하기 위해 권한이 필요합니다.(필수권한)";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UIUserInterfaceStyle = Light;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -612,11 +615,14 @@
DEVELOPMENT_TEAM = B3PWYBKFUK;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Escaper/Info.plist;
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "현재위치를 확인하기 위해 권한이 필요합니다.(필수권한)";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "현재위치를 확인하기 위해 권한이 필요합니다.(필수권한)";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UIUserInterfaceStyle = Light;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
14 changes: 7 additions & 7 deletions Escaper/Escaper/Domain/UseCase/RoomListUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ protocol RoomListUseCaseInterface {

class RoomListUseCase: RoomListUseCaseInterface {
private let repository: RoomListRepositroyInterface
private let locationManager: CLLocationManager = {
let manager = CLLocationManager()
manager.desiredAccuracy = kCLLocationAccuracyBest
manager.requestWhenInUseAuthorization()
return manager
}()

init(repository: RoomListRepositroyInterface) {
self.repository = repository
Expand All @@ -24,13 +30,7 @@ class RoomListUseCase: RoomListUseCaseInterface {
}

private func fetchCurrentDistrict(genre: Genre, completion: @escaping (Result<[Room], Error>) -> Void) {
let locationManager: CLLocationManager = {
let manager = CLLocationManager()
manager.desiredAccuracy = kCLLocationAccuracyBest
manager.requestWhenInUseAuthorization()
return manager
}()
guard let location = locationManager.location else { return }
guard let location = self.locationManager.location else { return }
let geocoder = CLGeocoder()
let locale = Locale(identifier: "Ko-kr")
geocoder.reverseGeocodeLocation(location, preferredLocale: locale) { placeMarks, _ in
Expand Down

0 comments on commit d100d3f

Please sign in to comment.