Open mmurali88 opened 10 years ago
I have confirmed that setting locations does not work on devices.
# neither of these works.
set_location({:latitude => lat, :longitude => lon})
uia("uia.setLocation(#{lat},#{lon})")
setLocationWithsetLocationWithOptions
also fails@CodeAccura @krukow
I filed a bug report with Apple after confirming that the problem persists on iOS 8/Instruments 6.0.
Please file a bug with Apple to let them know that this is a problem.
Here is my bug report - http://openradar.appspot.com/radar?id=4964878712307712
Please mention case 17838015 in your report.
Hey @jmoody, any update from Apple so far?
No. We are looking for alternative ways to spoof the location - perhaps by passing a GPX file.
Any suggestions are appreciated. Apple is probably never going to fix the API.
I tried using GPX file. It works fine under both simulator/device and it is fairly easy to used. But the only thing that makes us don't like about going that direction is we that need to teach the QAs how to use XCode. We think it might be easier to go with Instruments. Also, we spend sometime digging with spoofing GPS location with Bluetooth. By the end, all we know is that Apple does support location via external Bluetooth. However, it only supports a set of known manufactures. So it also kind of becomes a dead end to us as well. If you are interested, feel free to take sometime to look into that see if you find anything interesting. Kind regards. And thanks for the prompt response.
@yzhong52
Is it possible to pass a GPX to the application at runtime? I am thinking about passing this as an argument to the instrument command-line tool.
Do GPX files get embedded in the app bundle? Could they be embedded?
Is it possible to pass a GPX to the application at runtime? I am thinking about passing this as an argument to the instrument command-line tool.
Yes, it is possible to pass GPX to application at runtime. But I don't know how to pass it to command-line tool though.
Do GPX files get embedded in the app bundle? Could they be embedded?
Yes, they could be embedded in tha app bundle. Take a look at the foolowing screenshot (HelloWorld is the name of the gpx file). You can add more by Add gpx file to project...
Submitted bug: 22780309
Xcode 7 UIAutomation setLocation API is broken on iOS Simulators and physical devices
Opened a forum topic: https://forums.developer.apple.com/message/59898
Since Xcode 6, the setLocation API has been broken for physical devices.
Xcode 7 shows the same problems and now the API is broken for iOS Simulators.
Reproduced with https://developer.apple.com/library/ios/samplecode/LocateMe/Introduction/Intro.html
// Same result with setLocation()
target.setLocationWithOptions({"latitude":21.00,"longitude":78.0});
To see a new location in the table view row.
No new row is added.
I added some logging to the app in:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
I can see the method is being called.
I tailed the logs of a physical device (iPhone 6 iOS 9) and found:
Sep 21 14:38:11 hat kernel[0] <Notice>: Sandbox: ScriptAgent(1498) deny(1) mach-lookup com.apple.locationd.simulation
Sep 21 14:38:11 hat ScriptAgent[1498] <Warning>: CLSimulation: Couldn't clear simulated locations!
Sep 21 14:38:11 hat kernel[0] <Notice>: Sandbox: ScriptAgent(1498) deny(1) mach-lookup com.apple.locationd.simulation
Sep 21 14:38:11 hat ScriptAgent[1498] <Warning>: CLSimulation: Couldn't append simulated locations!
Sep 21 14:38:11 hat kernel[0] <Notice>: Sandbox: ScriptAgent(1498) deny(1) mach-lookup com.apple.locationd.simulation
Sep 21 14:38:11 hat ScriptAgent[1498] <Warning>: CLSimulation: Couldn't start location simulation!
Sep 21 14:38:11 hat kernel[0] <Notice>: Sandbox: ScriptAgent(1498) deny(1) mach-lookup com.apple.locationd.simulation
Sep 21 14:38:11 hat ScriptAgent[1498] <Warning>: CLSimulation: Couldn't flush!
$ xcrun xcodebuild -version Xcode 7.0 Build version 7A220
Apple has responded:
There are no plans to address this based on the following:
The Automation Instrument is no longer supported. Please migrate your tests to the XCTest UI Testing feature available in Xcode 7. Thanks!
We are now closing this report.
If you have questions about the resolution, or if this is still a critical issue for you, then please update your bug report with that information.
Please be sure to regularly check new Apple releases for any updates that might affect this issue.
My English is poor, sorry.
I hook com.apple.Maps
app in jailbroken devices and get private api CLSimulationManager
linker
When I call a private api directly
Class clazz = NSClassFromString(@"CLSimulationManager");
id cls = [[clazz alloc] init];
CLLocation * location = [[CLLocation alloc] init];
[location initWithLatitude:30.3 longitude:30.3];
[cls performSelector:@selector(setLocationRepeatBehavior:) withObject:location];
Got an error of this.
2018-02-24 09:35:33.341303 MockLocationMap[3506:363510] CLSimulation: Couldn't set location repeat behavior!
But com.apple.Maps
call this api successfully.
So? Any suggestions of simulate location?
UPDATED FOR Xcode 7
I have been working with set_location method to test my location based scenarios, I am able to make it work on the simulator. But I am out of luck when it comes to real device.
XPATH Locations
Commands I tried
Also logs from the console
only once I got this