I'd like to know whether it's possible to simulate locations in my app when testing it on a real iPhone connected to xcode(instead of the simulator) ?
It seems that it was possible via the Instruments->Automator in other versions of Xcode but this service has been removed from Xcode 8. Most probably location simulation in a real device is possible via user interface testing, but I've never done it.
I want to programatically simulate multiple locations with a delay so I'm pretty sure just a GPX file won't be enough.
Related
I have an app written in Swift 5 using Xcode 13.3.1 that has sensor reads but also a speedometer that works by using GPS which is set as a requirement in "Custom iOS Target Properties" to track speed which works great on an iOS Phone as there is cell service but I want to run the app in an iPad that is Wifi only- no cell service. When I try to run the app in Xcode using the iPad as a test device, it stops on install saying that it can not install because the iPad doesn't support GPS. I'm wondering if there is a way to disable the need for GPS in the Info Target Properties or in code, when a device that is WiFi only is attached? I'm fine with the fact that the Speedometer will not function as a result, but the sensor reads will still work.
GPS which is set as a requirement in "Custom iOS Target Properties"
That's the wrong approach. Basically using required hardware properties is frowned on. Just install anywhere, and then fail gracefully if the user tries to employ a feature that requires hardware that isn't there.
I've been developing iOS apps for some time now and I'm aware that the iOS simulators run code faster than their hardware counterparts - i.e. actual devices. I read the following on Apple's Testing and Debugging in Simulator documentation site.
Because the simulator is an app running on a Mac, it has access to the computer’s resources, including the CPU, memory, and network connection. All of these resources are likely to be faster than those found on a mobile device. As a result, the simulator is not an accurate test of an app’s performance, memory usage, and networking speed.
I understand that completely. I also understand that it's important to have multiple simulators to test different size-classes/resolutions.
What I don't understand, however, is why Apple include so many simulators for devices with the same resolution. See the following picture showing iPhone 6, 6s and 7 - all of which have the same screen size and resolution.
Given that the simulator runs at 'full speed' (regardless of which devices its actually simulating), what's the point of having all those simulators (each taking up a few GB of storage)?
Thanks in advance,
Loic
Each device type attempts to simulate the respective physical device, including features like the presence of force touch. If your trackpad supports force touch the Simulator will translate that into force on the simulated device, but only for device types that support it. There are also things like graphics class and memory class that enable or disable certain behaviors. (In theory Jetsam should more aggressively evict background apps on the iPhone 5 simulator compared to the iPad Pro simulator.)
You can use xcrun simctl to create or delete devices, including the default devices though Xcode updates may re-create default devices.
You can also create multiple simulator instances for the same device type if you want different photo libraries, permission settings (grant your app permission to use location in one and deny it in the other), and so forth.
Is there any way to simulate a location on an iOS device without having to run Xcode with gpx files to do so? I'm fluent in swift and objc and would like to make an app simulate a location without running Xcode. The down side is that when you want to simulate a location without being connected to Xcode the app does not continue to simulate the location. Any help would be greatly appreciated!
Sometimes I use a quite ugly hack to do that.
When you have your device connected to the Xcode while simulating location, just remove the lighting cable without killing an app directly.
The app will crash but when you relaunch it you will see it shows the same simualated location despite the fact it's no longer connected to the Xcode.
Note that this is not an elegant approach and to make your device location services work properly again, you have to run an app from Xcode on your device and explicitly set Debug/Simulate Location/Don't Simulate Location
I'm making an app for jailbreak that lock the device when the user launch the app. I've tried GSEventLockDevice(); from GraphicsServices.framework but this does not work properly because it locks the screen but does not power off the screen. Is there another way to lock the screen without MobileSubstrate?
Just as another alternative, check out this answer, which uses SBDimScreen(). You could use that in conjunction with GSEventLockDevice().
It appears that you may now (iOS 5+) need to add an entitlement to your app to use this call successfully. If you haven't done that before, here is an example of how to do so. Obviously, in this case, the entitlement in question must be changed to com.apple.backboard.client.
You also might see if #VictorRonin has experimented with this, as he commented on the question I linked to. I tested SBDimScreen() on a jailbroken iOS 4.2.1 device, but my newer devices are currently unavailable to run this test. I'll try it later on iOS 5.x and post an update.
Note: the answer I linked to from Elias has a different call altogether for iOS 6.
Look at these several questions:
Simulating System Wide Touch Events on iOS
Simulating System Wide Touch Events in iOS without jailbreaking the device
How to send a touch event to iPhone OS?
The idea is that you can simulate system wide events. One of events is power down event. If you simulate it, it will turn off device and will lock it.
BTW. You may be interested to google more on GSEvent which is the key for even simulation.
Here are couple of useful links:
http://iphonedevwiki.net/index.php/GSEvent
http://networkpx.blogspot.com/2009/08/gsevent-recording-and-playback-in-30.html
Also, this approach isn't limited to jailbroken phones. It works on jailed phone too (however, you won't be able to post it to AppStore).
I've got a newbie question about phoneGap and creating apps for iOs.
If my phoneGap app runs in device emulator in xCode and everything is ok, can I be sure that it will work the same way on a real iOS device when I publish it in the appstore?
The XCode simulator does what the name suggest - 'simulates'. It is not identical to the actual hardware, for a number of reasons. Here are just a few of them:
Performance - your computer has much more memory and processing power available than the phone itself. Your app may run fine on the simulator, but quite slow on the device. This is why it's a good idea to run on the device itself, especially if you're doing stuff which could use up a lot of memory.
Missing features - the simulator doesn't allow certain things to be tested, like in app purchase or media/asset management. And obviously you're missing things like the camera, the accelerometers, compass, etc. You can from iOS 5 simulate certain things like the GPS, but nowhere near everything.
Visuals - the simulator runs at your monitor resolution, whereas the phone itself has a much higher DPI display. Things that look readable or fine on the simulator can on device look very different.
If you're not testing your app on an actual device before releasing it to the app store you're doing a disservice to your users - this is Apple's point of view, and one shared by most developers. It's not necessarily what you might want to here, but unfortunately the simulator really is just that - a simulator. You wouldn't want to be in a plane piloted by somebody who had only trained on a simulator. And you probably wouldn't want to use an app that had only been run on the iOS simulator.
Here's what Apple have to say about it in their own documentation:
Although you can do much of your debugging and testing of an iOS application using iOS Simulator, simulation cannot completely match the results of running your application on the target devices; you must test your application on actual devices to ensure that it runs as intended and to tune it for performance on actual hardware.