-
[iOS] 사용자 동의 없이 사용자의 위치를 파악하기앱등이에게 살충제를 뿌린다./iOS 2017. 10. 12. 15:14
<어그로를 위한 쯔다람쥐>
아이폰으로 사용자 동의 없이 사용자의 위치를 파악하고 싶다면, 하지 마라
우선, 사용자의 위치를 파악할 수 있을 만한 방법은 두 가지 정도 존재하겠다.
1. CLLocationManager를 사용한다. -> 사용자 동의 필수
2. 사용자의 IP주소를 파악하여, IP로 조회한다. -> 리젝 사유가 되기에 충분함
어차피 애플은 사용자 동의 없이, 개발자에게 사용자의 위치를 알려줄 생각이 없다.
그래서, 유심을 통해서 국가 정도만 알아 내자.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersimport UIKit import CoreTelephony class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() print(Helper.getDialingCode()) } } class Helper { static func getDialingCode() { let networkInfo = CTTelephonyNetworkInfo() let countryCode = networkInfo.subscriberCellularProvider?.isoCountryCode ?? Locale.current.regionCode! let path = Bundle.main.path(forResource: "IntlDialingCodes", ofType: "plist")! let dict = NSDictionary(contentsOfFile: path)! if let dialingCode = dict[countryCode.lowercased()] as? String { print("Dialing code for \"\(countryCode.uppercased())\" is \"+\(dialingCode)\"") } else { print("Dialing code for \"\(countryCode.uppercased())\" not found in plist file") } } } 콘솔에는 이렇게 찍히게 된다.
Dialing code for "KR" is "+82"
Whatsapp사례
앱을 설치하면 내 동의따위 없어도, 내가 한국에서 사용중이란 것을 잘 안다.
심지어 지역이 덴마크로 설정되어 있음에도 불구하고!!
하지만 유심이 없는 기기라면? 같은 wifi를 사용중임에도 불구하고,일본으로 뜬다.
'앱등이에게 살충제를 뿌린다. > iOS' 카테고리의 다른 글