views:

51

answers:

2

I'm using a method CGPathGetPathBoundingBox that is only available in iOS 4.0. I'm doing a check against NULL to see if it is available as suggested in Apple Docs but I'm getting the following runtime error: dyld: lazy symbol binding failed: Symbol not found: _CGPathGetPathBoundingBox Referenced from: /Users/..

Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics

I set the Core Graphics framkework to type "weak", but to no affect. Same things happens on real device. When I step through in the debugger the if statement is always executed.

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

Maybe you need to use respondsToSelector instead?

Irene
CGPathGetPathBoundingBox() is a C function, not a class method.
hotpaw2
+1  A: 

I got this answer after posting to the Apple Dev Forum, it seems to be a bug:

CGPath.h says

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

But the docs say it's a 4.0 function. I believe that's the problem. I would file a bug. I'm not sure what the right workaround is because since the function isn't properly being weak linked your app will crash on an OS without the function.

agilpwc