Update: It seems like it is not possible as of now. However you can try the following codes, just in case if it helps.
Code1: Just a thought. Haven't tried this.
if (status == ReachableViaWiFi) //status = 1
{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel://"]]) {
NSLog(@"Wifi and 3G are available");
} else {
NSLog(@"Wifi is available, but 3G is not available");
}
}
Code 2:
For internal apps you can use this approach as mentioned here,
Note: This uses private API, so your app will be rejected if you use it in appstore app.
Copy paste the below contents into RadioPreferences.h
@protocol RadiosPreferencesDelegate
-(void)airplaneModeChanged;
@end
@interface RadiosPreferences : NSObject
{
struct __SCPreferences *_prefs;
int _applySkipCount;
id <RadiosPreferencesDelegate> _delegate;
BOOL _isCachedAirplaneModeValid;
BOOL _cachedAirplaneMode;
BOOL notifyForExternalChangeOnly;
}
- (id)init;
- (void)dealloc;
@property(nonatomic) BOOL airplaneMode;
- (void)refresh;
- (void)initializeSCPrefs:(id)arg1;
- (void)notifyTarget:(unsigned int)arg1;
- (void)synchronize;
- (void *)getValueForKey:(id)arg1;
- (void)setValue:(void *)arg1 forKey:(id)arg2;
@property(nonatomic) BOOL notifyForExternalChangeOnly; // @synthesize notifyForExternalChangeOnly;
@property(nonatomic) id <RadiosPreferencesDelegate> delegate; // @synthesize delegate=_delegate;
@end
Then try as below.
id rp = [[RadiosPreferences alloc] init];
BOOL status = [rp airplaneMode];
return status;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…