符号未找到_OBJC_IVAR _ $ _ NSView._layer(在AppKit中)仅在10.7上,在10.8和10.9上正常工作

时间:2014-02-13 16:53:18

标签: macos cocoa frameworks crash appkit

我的mac cocoa应用程序在10.8和10.9上正常工作,除了10.7(全新安装),启动时出现此错误:未找到符号:_OBJC_IVAR _ $ _ NSView._layer

Process:         xxx [875]
Path:            /Users/USER/Desktop/xxx.app/Contents/MacOS/xxx
Identifier:      com.xxx.xxx
Version:         1.0 (1)
Code Type:       X86-64 (Native)
Parent Process:  launchd [127]

Date/Time:       2014-02-13 17:44:24.208 +0100
OS Version:      Mac OS X 10.7.5 (11G63)
Report Version:  9

Crashed Thread:  0

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Symbol not found: _OBJC_IVAR_$_NSView._layer
  Referenced from: /Users/USER/Desktop/xxx.app/Contents/MacOS/xxx
  Expected in: /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
 in /Users/USER/Desktop/xxx.app/Contents/MacOS/xxx

(xxx = appname)

我检查了系统磁盘,在forlder /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit

中可以使用AppKit框架 很奇怪,不是吗? 谢谢你的帮助...

1 个答案:

答案 0 :(得分:1)

我通过删除所有代码中的这一行来修复此问题:

//self.layer = _layer; //Not necessary at all
self.wantsLayer = YES; //Necessary since 10.8

非常感谢您的帮助!