iOS detect mock locations

前端 未结 4 2109
悲哀的现实
悲哀的现实 2021-01-02 08:22

Currently I\'m working on an App which geolocation capabilities are its most important feature. Actually we\'re very concerned about getting GPS values mocked up. I\'ve read

4条回答
  •  一生所求
    2021-01-02 09:05

    To elaborate on @KennyHo answer, I found out that there is another difference between real and simulated locations feedback.

    A simulated location, as I noticed, always returns this combination of values for these location properties/options:

    horizontalAccuracy: 5
    verticalAccuracy: -1
    altitude: 0.000000
    speed: -1
    

    while a real location would give different combincation 99% of the time such as

    horizontalAccuracy: 5
    verticalAccuracy: 10
    altitude: +/- 0.4243232
    speed: -1
    

    Note that it is possible for a simulated location to have a different combination than the above one but only if the user uses xcode Automation target test. However the user can only simulate a location to a signed app with a development identity (must own the app). This means nobody, except you, can fake a location with different altitude or verticalAccuracy to trick your app in xcode.

提交回复
热议问题