使用私有框架:导入RadioPreferences.h

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

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

我不确定接下来要做什么。 我甚至不知道你可以转发声明协议。

首先将以下内容复制到一个名为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中转到您的目标的构build阶段 ,并展开链接二进制文件库部分。
  • 在查找器窗口中,导航到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/PrivateFrameworks 。 将path中的iPhoneOS6.0.sdkreplace为您定位的sdk。
  • 将AppSupport.framework拖到您的展开链接二进制库部分。

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