7

Xcodeでプライベートフレームワークをインポートする選択された回答に従っています

基本的に、アプリで機内モードを制御できるようにしたいです。アプリにインポートRadioPreferences.hしてコンパイルしようとするとExpected Identifier@class <RadiosPreferencesDelegate>;

次に何をすべきか正確にはわかりません。前方宣言プロトコルができることすら知りませんでした。

4

1 に答える 1

8

まず、次の内容を。という名前のファイルにコピーします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を、展開されたLink BinaryWithLibrariesセクションにドラッグします。

これですべてがコンパイルされ、クラスを使用できるようになります。

于 2012-11-14T22:07:55.530 に答える