开发者

Symbol not found: _UIPageViewControllerOptionSpineLocationKey

开发者 https://www.devze.com 2023-04-13 03:45 出处:网络
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'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

精彩评论

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