使用私有框架:导入RadioPreferences.h [英] Using Private Framework: Importing RadioPreferences.h

查看:152
本文介绍了使用私有框架:导入RadioPreferences.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm following the selected answer importing private frameworks in Xcode

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

Basically I want to be able to control Airplane mode in my app. When I import RadioPreferences.h into my app and try to compile, I'm getting Expected Identifier for @class <RadiosPreferencesDelegate>;

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

I'm not exactly sure what to do next. I didn't even know you can forward declare protocols.

推荐答案

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

First copy the following contents into a file named RadioPreferences.h. (Taken from 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 Phases 并展开 Link Binary With Libraries 部分。

  • 在Finder窗口中导航至 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/PrivateFrameworks 。在您要定位的sdk路径中替换 iPhoneOS6.0.sdk

  • 将AppSupport.framework拖到展开的链接二进制文件库部分。


    • Next, go to the Build Phases of your target in Xcode and expand the Link Binary With Libraries section.
    • In a finder window navigate to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/PrivateFrameworks. Replace iPhoneOS6.0.sdk in the path with the sdk you are targeting.
    • Drag AppSupport.framework over to your expanded Link Binary With Libraries section.
    • 现在一切都应该编译,你就可以使用这个类。

      Everything should now compile and you will be able to use the class.

      这篇关于使用私有框架:导入RadioPreferences.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆