使用专用框架:导入RadioPreferences.h



我正在按照所选答案导入Xcode 中的私有框架

基本上,我希望能够在我的应用程序中控制飞行模式。当我将RadioPreferences.h导入我的应用程序并尝试编译时,我得到了@class <RadiosPreferencesDelegate>;Expected Identifier

我不太确定下一步该做什么。我甚至不知道你可以转发声明协议。

首先将以下内容复制到名为RadioPreferences.h的文件中。(摘自https://stackoverflow.com/a/13095362/418715)。

@protocol RadiosPreferencesDelegate
-(void)airplaneModeChanged;
@end

@interface RadiosPreferences : NSObject
{
struct __SCPreferences *_prefs;
int _applySkipCount;
id <RadiosPreferencesDelegate> _delegate;
BOOL _isCachedAirplaneModeValid;
BOOL _cachedAirplaneMode;
BOOL notifyForExternalChangeOnly;
}
- (id)init;
- (void)dealloc;
@property(nonatomic) BOOL airplaneMode;
- (void)refresh;
- (void)initializeSCPrefs:(id)arg1;
- (void)notifyTarget:(unsigned int)arg1;
- (void)synchronize;
- (void *)getValueForKey:(id)arg1;
- (void)setValue:(void *)arg1 forKey:(id)arg2;
@property(nonatomic) BOOL notifyForExternalChangeOnly; // @synthesize notifyForExternalChangeOnly;
@property(nonatomic) id <RadiosPreferencesDelegate> delegate; // @synthesize delegate=_delegate;
@end

  • 接下来,转到Xcode中目标的构建阶段,并展开将二进制与库链接部分
  • 在查找器窗口中,导航到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/PrivateFrameworks。将路径中的iPhoneOS6.0.sdk替换为目标sdk
  • 将AppSupport.framework拖到扩展的链接二进制与库部分

现在一切都应该编译,您将能够使用该类。