How do I tap a tab in tvOS simulator? - xcode

I created a sample tvOS app in Xcode and selected "tabbed application".
Now I have a First, Second buttons at the top that looks like the equivilant of a tab bar. The simulator remote says "Press Option to touch". Pressing Option and clicking on the remote does nothing.
How do I change tabs?

There are a couple of ways to interact with the tvOS Simulator.
First is the via the simulator's Apple TV Remote. This can be enabled via the simulator's menu item Hardware->Show Apple TV Remote:
While holding the Option key on the Mac's keyboard, move the mouse cursor around the Apple TV Remote (specifically above the "Hold Option to touch" text).
Another way to interact with the tvOS Simulator is via the Mac's keyboard. This can be enabled via the simulator's menu item Hardware->Keyboard->Connect Hardware Keyboard. Once enabled, the arrow keys are able to change focus in the simulator.

Besides using Apple TV Remote, you can also use keyboard → and ← to select different tabs.

For Xcode 12.X and beyond you should go to Window -> Show Apple Tv Remote or use Shift + Command + R.
Image

Related

Mac keyboard shortcuts not working on iOS Simulator

All the mac keyboard short cuts like Cmd + Q (Quit Simulator app), Cmd + K (Toggle keyboard hide/show in Simulator) etc has stopped workings for iOS Simulator app since this morning suddenly.
All other apps, including Xcode, shows the shortcut in menus and they are working fine.
I noticed, the shortcut keys shows up against menu items momentarily on launch of simulator but then disappears completely (see attached)...
I tried following but no success...
Launch simulator (Open Xcode project and then menu Product > Run. And, directly through menu Xcode > Open Developer Tools).
Erase All Content and Settings in Simulator...
Restart Mac
Xcode 9.0.1 (9A1004) | Mac 10.13 (17A405)
You might have enabled (checked) the "Send all keyboard shortcuts to device" mode. It's in the Hardware > Keyboard submenu.
Pressing both Left and Right Cmd keys at the same time will exit keyboard capturing mode and re-enable menu shortcuts.
You might have disabled(unchecked) "Connect hardware keyboard" option which is in the hardware/keyboard menu. Make sure its checked.
You may need to press the esc key on newer versions of the simulator.
You can also choose which key stops shortcut capture.

How to simulate pressing the Android menu button in ARC

I'm using ARC Welder to test an APK in Chrome (on Windows). It works mostly fine but the app uses an old-style Android menu, opened by either pressing the hardware button on old devices, or touching the "3 vertical dots" soft button on newer ones.
However the ARC window doesn't use a menu button nor does there seem to be a keyboard shortcut to open the menu (not that I could find anyway).
Any ideas?
(Note: I know Google has more or less depricated there old style Android menus. But this is in an old APK).
ARC does not provide a way of simulating an Android menu button. We have thought about providing a button in the window frame, like we do for the back button, but we have not moved forward with it. Feel free to star the bug for it
Ctrl+Windows+Esc (Win key is to prevent Windows opening the Start menu):
https://github.com/vladikoff/chromeos-apk#tested-apps
Right Alt should work as well but most keyboards lack that key.
https://bugs.chromium.org/p/chromium/issues/detail?id=290361#c9

How to get device console in Xcode6?

I am exploring iOS8 beta. I couldn't find the device console logs in "Window->Devices->MyiPad". Can someone tell me how I can get the console logs?
You are on the right way. Just click on the small arrows down (see the image)and it will show you the Logs.
Here's an updated image of josef's answer with Xcode 7.3.1
1) Plug in the device and open Xcode
2) Choose Window -> Devices from the menu bar
3) Under the DEVICES section in the left column, choose the device
4) To see the device console, click the up-triangle at the bottom left of the right hand panel
5) Click the down arrow on the bottom right to save the console as a file
There's a small arrow pointing down under 'Installed Apps'. They've made it almost impossible to find on your own...
Xcode 9
Window -> Devices and Simulators

ios simulator: how to close an app

When you "run" the simulator from xCode, the app automatically launches, and then you can click the home button to suspend the app. What I want to do is close the app from within the simulator. So, how can this be done?
You can also do it with the keyboard shortcut shown under the simulator menu bar (Hardware-> Home).
The shortcut is ⌘+⇧+H, but you need to hit H twice in a row for it to simulate the double press that shows the apps.
For iOS 7 & above:
shift+command+H twice to simulate the double tap of home button
swipe your app's screenshot upward to close it
You'll see screenshots representing the apps suspended on your device - those screenshots respond to touch events. Swiping is the gesture you'll make to "fling" the screenshot off of the screen. Note that on machines where your mouse is intended to represent your finger, you'll click and swipe as if it is your finger tapping and making the gesture.
On the new iPhone X, the simulator was having issues with the mouse/finger gesture.
You can do a long press with the mouse and a close icon will appear. You can use the swipe up gesture as well to close the app.
I had a difficult time in finding a way in XCode 7.2, but finally I had found one. First press Shift+Command+ H twice. This will open up all the apps that are currently open.
Swipe left/right to the app you actually want to close.
Just Swipe Up using the Touchpad while Holding the App would close the app.
Window / Show Device Bezels
And now you can see the real device, so double tap on HOME button and kill you app
You can use this command to quit an app in iOS Simulator
xcrun simctl terminate booted com.apple.mobilesafari
You will need to know the bundle id of the app you have installed in the simulator.
You can refer to this link
Command + shift +h Press H 2 times
Note :- Press H 2 times
For closing (not quit) the running application in Simulator the keyboard shortcut is "shift+command+h".
Double click on the home button and then click and hold the icon like a normal phone and then click close I believe.
Easy way, just click on "Device" menu then select "App Switcher".
Check setting bar -> device -> App Switcher:
Now you can swipe the app up to close it
You can also kill the app by process id
ps -cx -o pid,command | awk '$2 == "YourAppNameCaseSensitive" { print $1 }' | xargs kill -9
this screenshot may be helpful . Click the simulator then go to Device -> App Switcher

Text editor keyboard shortcut that will refresh iOS Simulator's Safari browser?

In text editors like TextMate, pressing
COMMAND + R
will save the html document, switch to a browser like Chrome, and refresh the page.
So the question is, how does one use this keyboard shortcut to refresh the Safari browser within the iOS Simulator?
Is there another editor or program that's more interactive when developing for Safari on iOS?
Thanks for your help.
There's no shortcut within the simulator but if you set up Safari's enable Safari's developer tools (on your desktop) you can use that to debug the simulator. If you have dev tools open, the CMD + R shortcut will refresh the simulator.
Safari > Developer Tools > iPhone Simulator > name of your app
Then CMD + R will make it a lot easier for you!
there is no way to do this by default, but if you're comfortable with working in the shell (e.g. Terminal.app) you could look into something like this command line tool:
https://github.com/fingertips/ios-sim
not sure if you can launch built in apps like safari, tho.
one thing that may be of use is that in desktop safari, if you enable the Develop menu you can set your user agent to be iphone/ipod touch/ipad. i'm not sure how accurate this is, but it might be faster for iterating. (if you don't see the Develop menu in desktop safari, go to preferences, select Advanced and make sure the "Show Develop menu in menu bar" checkbox is checked)

Resources