如何在iOS 10/Sierra/Xcode 8中导入新的日志记录功能? [英] How do I import the new logging functions in iOS 10 / Sierra / Xcode 8?

查看:61
本文介绍了如何在iOS 10/Sierra/Xcode 8中导入新的日志记录功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 10和macOS Sierra中有一个新日志记录系统.

There is a new logging system in iOS 10 and macOS Sierra.

但是我似乎无法使其在Xcode中工作. os_log无法识别,文档中也未提及任何其他函数/常量.

But I can't seem to make it work in Xcode. os_log is not recognized, and neither is any other function / constant mentioned in the docs.

使用未解析的标识符'os_log'

Use of unresolved identifier 'os_log'

我需要链接框架或导入标头之类的东西吗?我缺少明显的东西吗?

Do I need to link a framework or import a header or something? Am I missing something obvious?

推荐答案

在Swift中:

import os

os_log("Some message")

在Objective-C中:

In Objective-C:

#import <os/log.h>

os_log(OS_LOG_DEFAULT, "Some message");

这篇关于如何在iOS 10/Sierra/Xcode 8中导入新的日志记录功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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