tisfeng/Easydict

🐞 反馈问题:Use of undeclared identifier 'SMAppService'

selfboot opened this issue · 6 comments

请先确认以下事项:

  • 已仔细阅读了 README
  • issues 页面搜索过问题(包括已关闭的 issue),但未能找到解决方法
  • Easydict 已升级到最新版本

问题描述

一些老机型只能升级到 MacOS 11 了,在这些机器编译的时候,会遇到 Use of undeclared identifier 'SMAppService' 错误。

image

看了下在 mac os 13才支持

In macOS 13 and later, use SMAppService to register and control LoginItems, LaunchAgents, and LaunchDaemons as helper executables for your app. When converting code from earlier versions of macOS, use an SMAppService object and select one of the following methods depending on the type of service your helper executable provides

重现步骤

mac os 11 编译

期望结果

能够支持更多的mac版本

解决方案(可选)

No response

设备信息 && 操作系统版本(可选)

11.7.6 (20G1231)

Hello selfboot, Thank you for your first issue contribution 🎉

应该是 xcode 版本(Version 13.2.1 (13C100))太低,我更新下 xcode 试试。
另外,这里可以过滤下 xcode 版本吗?

感谢反馈,这种版本环境问题我还真没遇到过 😂

不过真有办法可以实现按 Xcode 版本过滤吗?我谷歌没有找到,问了下 ChatGPT,虽然没找到机器测试,但总感觉它在胡说八道

image

查了一下苹果文档,似乎可以用这种系统宏来控制编译条件,不过不太确定这种方式能不能解决这个问题,我把代码推到 dev 分支,你可以跑一下吗

https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html#//apple_ref/doc/uid/20002000-1114741-CJADDEIB

#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1300

感谢反馈,这种版本环境问题我还真没遇到过 😂

不过真有办法可以实现按 Xcode 版本过滤吗?我谷歌没有找到,问了下 ChatGPT,虽然没找到机器测试,但总感觉它在胡说八道

image

我也是问了后告诉我这个,试了不行。不过我直接把这段代码删了就好了

也行,这段代码有点问题,反正现在没用到,我先注释了吧。