更新到 macOS 后收到有关"dynamic accessors failing"的未知错误



升级到macOS Sierra(10.12)和Xcode 8.0 (8A218a)后,我开始在我的macOS/Cocoa应用程序(用Objective-C编写)中得到以下格式的许多错误消息:

[error] warning: dynamic accessors failed to find @property implementation for 'uniqueId' for entity ABCDInfo while resolving selector 'uniqueId' on class 'ABCDInfo'.  Did you remember to declare it @dynamic or @synthesized in the @implementation ?
[error] warning: dynamic accessors failed to find @property implementation for 'uniqueId' for entity ABCDContact while resolving selector 'uniqueId' on class 'ABCDContact'.  Did you remember to declare it @dynamic or @synthesized in the @implementation ?
[error] warning: dynamic accessors failed to find @property implementation for 'uniqueId' for entity ABCDEmailAddress while resolving selector 'uniqueId' on class 'ABCDEmailAddress'.  Did you remember to declare it @dynamic or @synthesized in the @implementation ?
[error] warning: dynamic accessors failed to find @property implementation for 'address' for entity ABCDEmailAddress while resolving selector 'address' on class 'ABCDEmailAddress'.  Did you remember to declare it @dynamic or @synthesized in the @implementation ?

这些都不是我的代码或我正在使用的第三方开发人员库的代码,并且对这些变量名称(即:'uniqueId'或'ABCDInfo')进行搜索不会拉起任何东西,表明它不在我的项目中。

我看到这个问题在苹果的开发者论坛上也被报道过两次(第1期和第2期),但这两个问题都没有得到回答

我的问题是:是什么导致了这些错误信息,我该如何修复它们?它不会导致我的应用程序崩溃,但我宁愿找出并理解是什么错了。

首先让我们检查一下@synthesize和@dynamic是什么:

  • @synthesize将为属性生成getter和setter方法
  • @dynamic告诉编译器getter和setter方法不是由类本身实现的,而是在其他地方实现的(如超类(或将在运行时提供)

Contacts现在要求任何使用mail/contact框架的人都需要与uses-contacts权限共同设计。

你需要通过授予"联系人访问"权限来沙箱你的应用程序。警告仍然会被记录,但这与XCode 8的另一个错误有关,该错误记录了很多无用的东西。

似乎苹果将不再接受非沙盒应用程序访问联系人(或位置或日历)。

要沙箱你的应用,做下面的事情:进入你的项目设置>选择你的应用>启用应用沙箱,然后选择你正在使用的应用数据

可能与这个配置有关:

  • 您正在访问地址簿框架,可能使用"隐式合成属性"构建。
  • 你的软件是建立与'隐式合成属性'关闭

最新更新