Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Attempting to read OSLogStore in iOS 14 Beta 2
import OSLog
class LogReader: ObservableObject {
var log: OSLogStore
init?() {
do {
log = try OSLogStore.init(scope: .currentProcessIdentifier)
* Declared in OSLog/Store.h
* as - (nullable OSLogEnumerator *)entriesEnumeratorWithOptions:(OSLogEnumeratorOptions)options
position:(nullable OSLogPosition *)position
predicate:(nullable NSPredicate *)predicate
error:(NSError **)error
API_AVAILABLE(macos(10.15), ios(14.0), tvos(14.0), watchos(7.0))
* Swift refinement not visible? — use name prefixed with __
* See
let enumerator = try log.__entriesEnumerator(options: [], position: nil, predicate: nil)
var next: Any?
repeat {
next = enumerator.nextObject()
} while next != nil
} catch {
return nil
Result: Error Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named was invalidated.}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment