Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

os_log - use of unresolved identifier error

I'm trying to use the new os_log API, by logging a simple statement: os_log("Hello")

And I get an error for os_log: Use of unresolved identifier 'os_log'

I also tried wrapping it in a block, like this

if #available(iOS 10.0, *) {
    let foo: StaticString = "Something happened."
    os_log(foo)
}

And I still get the same error. I would like to use this in Swift 4.

I looked for possible frameworks that might be required, and found no likely candidates.

I found no solution from these links either:

https://developer.apple.com/documentation/os/logging

https://developer.apple.com/videos/play/wwdc2016/721/

like image 417
Sheamus Avatar asked Nov 29 '18 20:11

Sheamus


1 Answers

Because you forgot to

import os 

at the start of this file.

like image 73
matt Avatar answered Oct 02 '22 12:10

matt