Instruments automation trace only allows one target connection? - ios

I've created a simple javascript for my iOS app that I'd like to run simultaneously on multiple iOSDevices connected via USB to one host Mac machine. Launching instruments connected to an iPhone from the command line works fine but if I attempt to launch a second instruments connected to an iPad, the first instruments session hangs.
Upon terminating the first instruments session, I get one of more of the following lines printed:
Stopped: Script stopped due to device being disconnected
After extensive research on the subject, with no results on the phrase, I've been trying to read into what is meant by Apple's Instruments Guide:
When you choose All Processes, Attach to Process, or Choose Target from the Target menu, Instruments sets the default target for all instruments to the program you choose. There are occasions, however, when you might want to set a different target for each instrument. You might want to sample two different programs at the same time, for example, using the Sampler instrument. If you have some instruments that are capable of tracing all processes, you might want them to do just that while single-process instruments sample just one process.
I'm wondering if the Automation.tracetemplate is a single-process only instrument and that if another process is started with the same Automation trace then the first is usurped.
Any advice would be grateful as this is a major block for running our time intensive automation tests over multiple iOSDevices.
Update 27 Mar 2012
The following is from an email received after submitting a bug to Apple on the matter (developer.apple.com/bugreporter):
I heard back from a UI Automation engineer. UI Automation is a single process Instrument. As such, you cannot use it simultaneously on multiple devices.

You could try installing OS X in a virtual machine, and having two instances of the virtual machine running simultaneously. I know that might not be what you are looking for, but it should work.

Try to connect all your devices to a Mac OS X server then try if that fails get the device to pass it to the other one and then pass to the mac

You cannot run UI Automation simultaneously on multiple devices. Interestingly, even Xcode 5 bots seem to have this same limitation. :-/

Related

iOS simulator test multi-player games

I'm using iOS SpriteKit and Socket.io to create a simple multiplayer game, what is a elegant way to build and test it on multiple simulator (or actual iOS devices) and be able to see logs?
I see some post like this one Xcode6: Run two instances of the simulator which you can run two simulator, but I will have to run it on one simulator, stop it and start the second one. In this way it's making testing complicated and I'm not able to see logs of the first simulator.
Is there a better solution?
The best methods to use would be to install it on a device (or multiple) and let them run without having to see the logs immediately. Then you could run the simulator or a device directly from Xcode.
If you want access to the logs afterwards, there are ways to get them from the devices. You could take a look at https://developer.apple.com/library/content/qa/qa1747/_index.html for more resources.
Another method would be to copy the repository onto either a virtual machine or another Mac and run that at the same time as your computer. Then you could access both logs. Of course, it's not quite that quick to set up a virtual machine and not that common to just have a second Mac lying around.
Xcode9 will support running multiple simulator at same time.

Do I need the source code of the app to get performance metrics using Instruments?

I am interested in evaluating performance to an external iOS app. Can I use instruments only with binaries?
Is also around non-apple tools to do this?
thanks,
You should be able to use Instruments with your device and attach it to any running process.
Launch the app yourself and then attach to it from the Attach to Process... command in the Target menu in the Instruments window

XCode Instruments collects no data

I'm trying to debug a potential javascript memory leak on iOS. My approach (was) to monitor Mobile Safari on my iPad using Instruments, but there's a problem: no matter what process I attach Instruments to, I get no data at all. After setting up the items to watch and starting the monitor, it runs along happily, but shows no memory usage, no CPU usage, nothing. Is there something I need to do with my iPad or Instruments to enable collection of this data?
I also had this issue with xCode 6 where the instruments would show like it's recording data although there was no actual data presented or collected.
Restarting my Mac Mini, restarting xCode, cleaning the build and disconnecting and connecting my iPad did not solve this issue.
However, my other devices were profiling just fine.
The solution I found is to reboot the iPad. (You reboot your device holding the home button and the power button for a few seconds. Then to turn it on again you press the power button).
This solved this issue and I was told it can solve other xCode related issues like when your program keep running on Debug even when you run it on Release.
Hope this helps.

Specifying the device with lldb on ios

Let's imagine that I have 2 iPhones (or iPads) connected to my Mac and I have to automate a test calling the lldb and loading an app from the COMMAND LINE, not XCODE; so how can I specify which device it should use? Maybe some kind of extra param when calling platform select remote-ios?
lldb does not know how to load apps onto an iOS device, or to start up connections to the debug agent on an iOS device. That bit is done by Xcode, and then the connections are handed off to lldb. Xcode has a fair bit of support for automating test cases for iOS debugging. That's the only supported way to do this at present.

Testing iPad applications

Bit of a hardware question here. I am developing iPad applications for a client and am finding that when I send over beta versions for the client to test, he is finding many more crashes on his devices than I am seeing. A lot of these crashes are 'low memory crashes' which I simply am not seeing/able to reproduce.
Am wondering what differences between the 2 devices there may be so that we can work out if it is a hardware issue. Any ideas?
Make sure of the client's configuration/environment matches your environment. Eg: Outlook Exchange Sync, MobileMe sync. In my Contacts application these caused a lot of crashes because of these.
If possible add more logs and get the logs from console of the client device and verify.
Possibly your client has more stuff running at the same time. Or your own app is background-enabled and is getting killed from time to time...
Always test your own code with the Simulator - it has a feature that allows you to simulate low memory warnings.

Resources