UIAutomation on device hangs in starting capture - iphone

When I try to capture UI inputs on the device using UIAutomation, it hangs saying "Starting Capture".
1) I click on Profile in Xcode which
2) Starts up Instruments where I select Automation and click Profile
3) Which starts Instruments running. In Scripts I select Add->Create which shows the record button at the bottom
4) I click the record button and it hangs saying "Starting Capture" and doesn't record my UI input.
My Profile scheme's Build Configuration is Debug.
Any idea what I am missing that is causing UIAutomation to hang?

For an iOS8 device, also make sure that UI Automation is enabled in Settings.
Settings -> Developer -> Enable UI Automation

Figured it out. I hope this helps someone else!
1) Click on Profile in Xcode (or Cmd-I)
2) In Instruments select Automation and click Profile
3) Click Instruments Record button to stop the running of the app
4) Click Scripts -> Add -> Create
5) Click Record button at bottom of Instruments (which is for recording the script)
6) Click Record button at top of Instruments (which is for running the app)
7) Click on Trace Log -> Script to view the script you are creating.
Whew!

Check if you've chosen Debug mode in the Profile Scheme and also you've got the correct signing identity and the provisioning profile.

Related

How do I profile my app - the menu item is disabled?

How do I profile my app in xcode - the menu item is disabled?
Product > Profile is disabled
This is very unlikely but still, one possible reason:
Make sure correct 'Executable' is selected in 'Profile' option for your Scheme. If the selected executable is 'None', profile option will be disabled.
In case you don't know how to check scheme settings, you can check these setting by selecting 'Edit Scheme' either from Scheme menu (App name and device/simulator drop downs near the Run and Stop button ) or from 'Product' menu of xcode
My profile menu item was also dimmed.
I realized I had disconnected my iPhone from my Mac which broke the product destination link. If you've been testing on your phone, try resetting the product destination.
If the phone doesn't show up in the Product/Destination submenu do the following:
Run a terminal session.
In terminal type the following:
sudo launchctl stop com.apple.usbmuxd
Unplug and replug your phone to your Mac.
If your phone still doesn't appear in the Product/Destination submenu, restart Xcode and repeat step three.
Set your phone in the Product/Destination submenu.
Your Profile menu item should be undimmed.

iphone -- XCode 4 jumps to main at simulator stop

when I press stop on the simulator in XCode 4, XCode jumps to the main.m file. Anyone know how to turn this off?
Go to Preferences -> Behaviors. Choose "Run Completes" in the left hand side. Check the box next to "Show Tab" and enter a tab name. I use "Edit".
This way whenever you stop, you will always be back at a tab called Edit.

Screenshot of currently running application on IPhone

On the IPhone, is it possible to get a screenshot of the currently running application, from another application that is running/backgrounded/being launched? or somehow make available a screenshot of the current application to another application that is then automatically launched?
No it is not possible. It is not possible to know anything about another apps in iOS (if you're using documented methods).
This is possible using Xcode's Organizer:
in Xcode, select "Window" menu and then "Organizer"
in the newOrganizer window, select "Devices"
select your iPhone device and unfold
select "Screenshots" at the bottom of the list
now click on the "New screenshot" button (bottom right of the window)
You can export screenshots just by drag/drop on your desktop.

Xcode 4: How do you view the console?

I can't seem to find a way to have the console run (to show NSLog comments) in XCode 4. The normal method for the previous version of XCode does not work. Does anyone have an idea of how to accomplish this?
You need to click Log Navigator icon (far right in left sidebar). Then choose your Debug/Run session in left sidebar, and you will have console in editor area.
for Xcode 5:
View->Debug Area->Activate Console
shift + cmd + c
If you just want to have the log output display when you run your app then you can go into XCode4 preferences -> Alerts and click on 'Run starts' on the left hand column.
Then select 'Show Debugger' and when you run the app the NSLog output will be displayed below the editor pane.
This way you don't have to select on the 'up arrow' button at the bottom bar.
The console is no extra window anymore but it is under the texteditor area. You can set the preferences to always show this area. Go to "General" "Run Start" and activate "Show Debugger". Under "Run completes" the Debugger is set to hide again. You should deactivate that option. Now the console will remain visible.
EDIT
In the latest GM Release you can show and hide the console via a button in the toolbar. Very easy.
Here' an alternative
In Xcode 4 short cut to display and hide console is (command-shift-Y) , this will show the console and debugger below ur text edior in the same window.
You can always see the console in a different window by opening the Organiser, clicking on the Devices tab, choosing your device and selecting it's console.
Of course, this doesn't work for the simulator :(
There's two options:
Log Navigator (command-7 or view|navigators|log) and select your debug session.
"View | Show Debug Area" to view the NSLog output and interact with the debugger.
Here's a pic with both on. You wouldn't normally have both on, but I can only link one image per post! http://i.stack.imgur.com/4gG4P.png
Here's an alternative.
In XCode4 double-click your Project (Blueprint Icon).
Select the Target (Gray Icon)
Select the Build Phases (Top Center)
Add Build Phase "Run Script" (Green Plus Button, bottom right)
In the textbox below the Shell textfield replace
"Type a script or drag a script file from your workspace" with
"open ${TARGET_BUILD_DIR}/${TARGET_NAME}"
This will open a terminal window with your command-line app running in it.
This is not a great solution because XCode 4 still runs and debugs the app independently of what you're doing in the terminal window that pops up.

What can be causing the problem that I can't make a screenshot from my iPhone app in the Organizer window?

For some reason, when I press "Capture" while my device is connected and running the app (launched via Build & Run in Xcode), nothing happens. Never get a screenshot. iPhone OS 3.0. What can be the problem.
I've had this problem—it seems to be caused by there being a screenshot currently selected in the Organizer. Click on the left-hand screenshot pane to highlight it (i.e. deselect whatever screenshot thumbnail is selected), then hit the Capture button.