iphone - 在 iPhone 上使用私有(private) API 检查和切换飞行模式

标签 iphone private-methods airplane-mode

有人知道如何使用专用 API 检查和切换飞行模式吗? (不,SCNetworkReachability 还不够好,是的,我很高兴使用将来可能会崩溃的私有(private) 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]);

关于iphone - 在 iPhone 上使用私有(private) API 检查和切换飞行模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13317776/

相关文章:

objective-c - Objective C 关于类别的解释?

iphone - UI iOS 自动化 : I want to background the app and click the settings panel to put the phone into airplane mode to test the apps offline behaviour

java - 设置plane_mode_on已从android.provider.Settings.System移至android.provider.Settings.Global,返回只读值

c# - CGPDFDocument 和 CGPDFPage 的 MonoTouch CoreGraphics PDF 内存问题

iphone - NSData dataWithContentsOfURL 慢

iphone - 访问 bool 值表单 Sqlite 数据库

c++ - 如何使用其复制构造函数和复制赋值是私有(private)的对象?

ruby-on-rails - Rails 使用参数测试 Controller 私有(private)方法

android - 手机进入休眠状态时 Handler.sendMessage Delayed() 是否有效?

jquery - 在没有表单/输入字段的情况下使用带有 Phonegap 的 iOS 键盘?