簡體   English   中英

在iPhone上使用專用API檢查並切換飛行模式

[英]Check and Toggle Airplane Mode with Private APIs on iPhone

有誰知道如何使用私有API檢查和切換飛行模式? (不,SCNetworkReachability不夠好,是的,我很高興使用將來可能會中斷的私有API。)

您可能會發現此鏈接很有趣:

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]);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM