【问题标题】:Check function exists - Lazy Symbol Binding Failed检查功能是否存在 - 懒惰符号绑定失败
【发布时间】:2010-09-05 15:38:15
【问题描述】:

我正在使用仅在 iOS 4.0 中可用的方法 CGPathGetPathBoundingBox。我正在检查 NULL 以查看它是否可以按照 Apple Docs 中的建议使用,但我收到以下运行时错误: dyld:惰性符号绑定失败:找不到符号:_CGPathGetPathBoundingBox 引用自:/Users/..

预计在:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics

我将核心图形框架设置为“弱”类型,但没有影响。在真实设备上也会发生同样的事情。当我在调试器中单步执行时,总是执行 if 语句。

if (CGPathGetPathBoundingBox != NULL) {  
        self.smallBounds = CGPathGetPathBoundingBox(tempPath);
    }
    else {
        self.smallBounds = CGPathGetBoundingBox(tempPath);
    }

【问题讨论】:

    标签: iphone objective-c


    【解决方案1】:

    我在 Apple Dev Forum 发帖后得到了这个答案,这似乎是一个错误:

    CGPath.h 说

    CG_EXTERN CGRect CGPathGetPathBoundingBox(CGPathRef path) CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_2_0);
    

    但文档说这是 4.0 功能。我相信这就是问题所在。 我会提交一个错误。 我不确定正确的解决方法是什么,因为由于该功能未正确链接,您的应用将在没有该功能的操作系统上崩溃。

    【讨论】:

      【解决方案2】:

      也许您需要改用respondsToSelector

      【讨论】:

      • CGPathGetPathBoundingBox() 是 C 函数,不是类方法。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-18
      • 1970-01-01
      • 2013-02-16
      • 2020-11-24
      • 1970-01-01
      • 1970-01-01
      • 2014-01-01
      相关资源
      最近更新 更多