2

有谁知道如何使用私有 API 检查和切换飞行模式?(不,SCNetworkReachability 不够好,是的,我很高兴使用将来可能会中断的私有 API。)

4

1 回答 1

4

您可能会发现此链接很有趣:

iOS 6 运行时标头搜索“飞机”

查看第二次命中

// 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 存储库的自述文件):

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 回答