Xcode 9,我的NSLog()在哪里?未在Xcode控制台或Console.app中显示 [英] Xcode 9, where are my NSLog()s going? Not showing in Xcode console or Console.app

查看:958
本文介绍了Xcode 9,我的NSLog()在哪里?未在Xcode控制台或Console.app中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在处理应用时进行一些基本的日志记录。我把一些 NSLog() s扔进了我的代码,但是没有任何东西打印到下面的Xcode控制台。没什么,甚至没有应用启动时的一些启动信息等。

I'm trying to do some basic logging while I work on an app. I tossed some NSLog()s into my code, but nothing is being printed to the Xcode console below. Literally nothing, not even some startup info as the app launches, etc.

我的Xcode控制台设置为显示所有输出我已经让变量检查员和控制台打开了:

I've got my Xcode console set to display All Output and I've got the variable inspector and the Console open:

我听说过记录更改并且引入了一个新的Console.app我也会让我查看模拟器上的日志,所以我想也许日志会显示在那里,但是当我这么做时会发生很多系统消息,我看不到我正在制作的NSLog()。

I heard about Logging changes and that a new Console.app was introduced that would let me view the logs on the simulators as well, so I thought maybe the logs would show up over there, but while I do so lots of system messages happening I don't see the NSLog()s that I'm making.

我错过了什么吗?我需要翻新一个新设置吗?我在哪里可以看到我的NSLog()s?

Am I missing something? Is there a new setting I need to flip? Where can I see my NSLog()s?

编辑:

我是用iOS 11做的模拟器,没有控制台输出。当我切换到iOS 9模拟器时,我得到了所有的控制台输出。

I was doing this with an iOS 11 simulator and got no console output. When I switched to an iOS 9 simulator then I got all of the console output.

推荐答案

想出来。这不是间歇性问题,也不是可以通过重启来解决的问题。这是一个运行配置问题。

Figured it out. It's not an intermittent issue or one that can just be fixed with a restart. It's a Run configuration issue.

单击Xco​​de左上角的Run Scheme选择器。

Click on the Run Scheme selector in the top left of Xcode's toolar.

点击管理方案。

点击你的主应用项目。

点击左下方的编辑按钮。

Click the Edit button in the bottom left.

取消选中 OS_ACTIVITY_MODE

点击关闭。

Viola。您的所有控制台日志都会恢复。

Viola. All your console logs come back.

< img src =https://i.stack.imgur.com/UJNZg.pngalt =在此处输入图像说明>

这篇关于Xcode 9,我的NSLog()在哪里?未在Xcode控制台或Console.app中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆