Skip to content

Commit

Permalink
Fix the device model on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
ocollet committed Apr 22, 2020
1 parent b2cebf0 commit 4545f78
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Snowplow/SystemInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ struct SystemInfo {

static var deviceModel: String {
#if os(macOS)
return "Mac"
var size = 0
sysctlbyname("hw.model", nil, &size, nil, 0)
var machine = [CChar](repeating: 0, count: size)
sysctlbyname("hw.model", &machine, &size, nil, 0)
return String(cString: machine)
#else
return UIDevice.current.model
#endif
Expand Down

0 comments on commit 4545f78

Please sign in to comment.