I want to see what happens in the iOS Simulator if I\'m not testing the app in Xcode.
For example, if I open a link in the Safari simulator, see what happens in the
You should not rely on instruments -s
. The officially supported tool for working with Simulators from the command line is xcrun simctl
.
The log directory for a device can be found with xcrun simctl getenv booted SIMULATOR_LOG_ROOT
. This will always be correct even if the location changes.
Now that things are moving to os_log
it is easier to open Console.app on the host Mac. Booted simulators should show up as a log source on the left, just like physical devices. You can also run log commands in the booted simulator:
# os_log equivalent of tail -f
xcrun simctl spawn booted log stream --level=debug
# filter log output
xcrun simctl spawn booted log stream --predicate 'processImagePath endswith "myapp"'
xcrun simctl spawn booted log stream --predicate 'eventMessage contains "error" and messageType == info'
# a log dump that Console.app can open
xcrun simctl spawn booted log collect
# open location where log collect will write the dump
cd `xcrun simctl getenv booted SIMULATOR_SHARED_RESOURCES_DIRECTORY`
If you want to use Safari Developer tools (including the JS console) with a webpage in the Simulator: Start one of the simulators, open Safari, then go to Safari on your mac and you should see Simulator in the menu.
You can open a URL in the Simulator by dragging it from the Safari address bar and dropping on the Simulator window. You can also use xcrun simctl openurl booted <url>
.
tailing /var/log/system.log
didn't work for me. I found my logs by using Console.app
. They were in
~/Library/Logs/iOS Simulator/{version}/system.log
You can view the console for the iOS Simulator via desktop Safari. It's similar to the way you use desktop Safari to view the console for physical iOS devices.
Whenever the simulator is running and there's a webpage open, there'll be an option under the Develop menu in desktop safari that lets you see the iOS simulator console:
Develop -> iPhone Simulator -> site name
[Loggers]
You can use the Console
application(select your device in Devices) on your Mac to see a log message that were sent using NSLog
, os_log
, Logger
(you will not see logs from print
function).
Also please check (Action -> Include <Info/Debug> Messages)
Please note that if you want to see a log from WebView
(UIWebView
or WKWebView
) you should use Safary -> Develop -> device
[Find crash log]
Download the safari technology review. With the simulator running, select develop > simulator > localhost
You can see the Simulator console window, including Safari Web Inspector and all the Web Development Tools by using the Safari Technology Preview app. Open your page in Safari on the Simulator and then go to Safari Technology Preview > Develop > Simulator.