UISplitViewController subclass in a universal app
I am building a universal app that uses a UISplitViewController for the iPad, and should work on any 3.0 device such as a 1st gen iPhone/iPod touch too. The trouble is that despite the fact that I am not actually creating any instances of UISplitViewController while the app is running on an iPhone, I still get the dreaded
dyld: Symbol not found: _OBJC_CLASS_$_UISplitViewController
Referenced from: /var/mobile/Applications/.....
Expected in: /System/Library/Frameworks/UIKit.framework/UIKit
errors in console when attempting to run on a 1st gen iPod touch. Everything works fine on iOS 4 devices though. I'm guessing the problem is that I have subclassed UISplitViewController and it chokes when reading "@interface SplitControl : UISplitViewController {" line from a .h file.
The only reason I subclassed it is to override shouldAutorotateToInterfaceOrientation method. I am doing my whole app programmatically with no IB. Would it help if I used IB to create that SplitViewController and tell it to support all orientations?
Is there a way to开发者_运维问答 override shouldAutorotateToInterfaceOrientation without subclassing the controller? Any other way to hide UISplitViewController from pre-3.2 devices?
All you need to do is link UIKit.framework weakly. In General settings for your target, in the list of "Linked Libraries" change the type for UIKit.framework to "Weak" instead of "Required".
精彩评论