开发者

Symbol not found: _UIPageViewControllerOptionSpineLocationKey

I'd like to have the page-curl animation when my app runs on iOS 5, for iOS 4-devices I made a custom animation.

I'm setting the spineLocation manually, as it didn't work otherwise (see: UIPageViewController: pageViewController:spineLocationForInterfaceOrientation: not called):

if ([UIPageViewController class]) {
   NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithInt:UIPageViewControllerSpineLocationMid], UIPageViewControllerOptionSpineLocationKey, nil];
   ...

But that gives me at runtime on iOS4:

 Symbol not found: _UIPageViewControl开发者_JAVA技巧lerOptionSpineLocationKey

The code isn't reached on iOS4-devices, nevertheless it crashes with that error message. What can I do to make that work?

Thanks!


I think you'll need to weak link to the UIKit framework. From the documentation, it looks like UIPageViewControllerOptionSpineLocationKey is a static variable so checking for the object isn't enough to avoid the runtime error.


Don't weak-link UIKit unless you want a less-performant app, especially on startup! For this specific problem you can work around with just using

@"UIPageViewControllerOptionSpineLocationKey"

instead of the constant defined in UIKit. It's ugly, but it gets the job done without weak-linking the whole framework.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜