2

プライベートAPIを使用して機内モードを確認および切り替える方法を知っている人はいますか?(いいえ、SCNetworkReachabilityは十分ではありません。はい、将来壊れてしまう可能性のあるプライベートAPIを使用できてうれしいです。)

4

1 に答える 1

4

このリンクは興味深いかもしれません:

iOS 6 ランタイム ヘッダーは「飛行機」を検索します

2番目のヒットをチェックしてください:

// RadiosPreferences.h

@class <RadiosPreferencesDelegate>;

@interface RadiosPreferences : NSObject  {
    struct __SCPreferences { } *_prefs;
    int _applySkipCount;
    <RadiosPreferencesDelegate> *_delegate;
    BOOL _isCachedAirplaneModeValid;
    BOOL _cachedAirplaneMode;
    BOOL notifyForExternalChangeOnly;
}

@property BOOL airplaneMode;
@property BOOL notifyForExternalChangeOnly;
@property <RadiosPreferencesDelegate> * delegate;


- (void)setAirplaneMode:(BOOL)arg1;
- (id)init;
- (void)setValue:(void*)arg1 forKey:(id)arg2;
- (void)dealloc;
- (void)synchronize;
- (void)setDelegate:(id)arg1;
- (id)delegate;
- (BOOL)airplaneMode;
- (void*)getValueForKey:(id)arg1;
- (void)refresh;
- (void)initializeSCPrefs:(id)arg1;
- (void)notifyTarget:(unsigned int)arg1;
- (void)setCallback:(int (*)())arg1 withContext:(struct { int x1; void *x2; int (*x3)(); int (*x4)(); int (*x5)(); }*)arg2;
- (void)setNotifyForExternalChangeOnly:(BOOL)arg1;
- (BOOL)notifyForExternalChangeOnly;

@end

これらの結果を使用する方法の例を次に示します (その GitHub リポジトリの readme から)。

NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/GAIA.framework"];
BOOL success = [b load];

Class SKTelephonyController = NSClassFromString(@"SKTelephonyController");
id tc = [SKTelephonyController sharedInstance];

NSLog(@"-- myPhoneNumber: %@", [tc myPhoneNumber]);
NSLog(@"-- imei: %@", [tc imei]);
于 2012-11-10T00:16:11.907 に答える