diff --git a/v2/internal/frontend/desktop/darwin/frontend.go b/v2/internal/frontend/desktop/darwin/frontend.go index 7e3b4babf..6b98f30e1 100644 --- a/v2/internal/frontend/desktop/darwin/frontend.go +++ b/v2/internal/frontend/desktop/darwin/frontend.go @@ -5,7 +5,7 @@ package darwin /* #cgo CFLAGS: -x objective-c -#cgo LDFLAGS: -framework Foundation -framework Cocoa -framework WebKit -framework UniformTypeIdentifiers +#cgo LDFLAGS: -framework Foundation -framework Cocoa -framework WebKit #import #import "Application.h" #import "WailsContext.h" diff --git a/v2/pkg/commands/build/base.go b/v2/pkg/commands/build/base.go index 144aa1025..ed9ca366a 100644 --- a/v2/pkg/commands/build/base.go +++ b/v2/pkg/commands/build/base.go @@ -3,6 +3,7 @@ package build import ( "bytes" "fmt" + "github.com/wailsapp/wails/v2/internal/system" "os" "os/exec" "path/filepath" @@ -319,11 +320,21 @@ func (b *BaseBuilder) CompileProject(options *Options) error { return "1" }) if options.Platform == "darwin" { + // Determine verison + info, err := system.GetInfo() + if err != nil { + return err + } + versionSplit := strings.Split(info.OS.Version, ".") + addUTIFramework := versionSplit[0] == "10" // Set the minimum Mac SDK to 10.13 cmd.Env = upsertEnv(cmd.Env, "CGO_LDFLAGS", func(v string) string { if v != "" { v += " " } + if addUTIFramework { + v += "-framework UniformTypeIdentifiers " + } v += "-mmacosx-version-min=10.13" return v