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

nin*_*eer 6 iphone objective-c private-functions ios

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

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

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

Joe*_*Joe 8

首先将以下内容复制到名为的文件中RadioPreferences.h.(摘自/sf/answers/916675371/).

@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
Run Code Online (Sandbox Code Playgroud)
  • 接下来,转到Xcode中目标的Build Phases并展开Link Binary With Libraries部分.
  • 在查找窗口中导航到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/PrivateFrameworks.使用iPhoneOS6.0.sdk您定位的sdk 替换路径.
  • 将AppSupport.framework拖到扩展的Link Binary With Libraries部分.

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