2
有誰知道如何使用私有API檢查並切換飛行模式? (不,SCNetworkReachability不夠好,是的,我很高興能使用私有的API,這將在未來可能會破壞)。在iPhone上使用私有API檢查並切換飛行模式
有誰知道如何使用私有API檢查並切換飛行模式? (不,SCNetworkReachability不夠好,是的,我很高興能使用私有的API,這將在未來可能會破壞)。在iPhone上使用私有API檢查並切換飛行模式
您可能會發現這個有趣的鏈接:
iOS 6 Runtime Headers search for "airplane"
檢查出second hit:
// 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]);
藍牙有沒有類似的? –
@yulz這是您的[搜索查詢](https://github.com/search?q=repo%3Anst%2FiOS-Runtime-Headers+bluetooth&repo=&langOverride=&start_value=1&type=Code&language=);這裏有一個[很有希望的結果](https://github.com/nst/iOS-Runtime-Headers/blob/3686717e107fa36a990fac20c30da2da9a25b698/PrivateFrameworks/BluetoothManager.framework/BluetoothManager.h)。 – smileyborg
非常感謝您的回覆,我一定會嘗試一下 –