isAirplaneEnabled always return true
DCKT opened this issue Β· comments
Hello,
On iOS only , isAirplaneEnabled()
always return true.
It works perfectly on Android. Maybe a config issue ?
Thanks π
Have you run the example ?
It works fine in my iPhone 7 plus (iOS 11.3.1), how about your test device?
Hi @c19354837
I does compile on the simulator but not on my test device, I have this error :
EDIT : I'm on the latest XCode version I think (9.3.1) & my test device is an iPhone 5C (iOS 10.3.3)
Some APIs may not work well in simulator, and you should test in the physical device.
The error is React-Native's bug, see this PR
I just change the code to:
static NSString *RCTCacheKeyForImage(NSString *imageTag, CGSize size, CGFloat scale,
RCTResizeMode resizeMode, NSString *responseDate)
{
return [NSString stringWithFormat:@"%@|%g|%g|%g|%lld|%@",
imageTag, size.width, size.height, scale, (long long)resizeMode, responseDate];
}
It's really strange.
I'll try to find a iPhone with iOS 10. It may take some time.
For some iOS's limits, this lib just opens the Settings app whit the last page that you open.
Thanks for your quick answers π
I think I get it.
I get airplane's status by:
NSString * radio = [[CTTelephonyNetworkInfo alloc] init].currentRadioAccessTechnology;
bool isEnabled = radio == nil;
and the currentRadioAccessTechnology
means The current radio access technology the device is registered with
.
Normally, if your device has no SIM, isAirplaneEnabled()
always return true
.
There is no official API which can get airplane mode directly.
Here are some discussions.
And
Is it normal, when I want to toggle the switch it send me to the bluetooth settings ?
It's a bug in iOS 10, and it's normal in iOS 11 for some system limits. Next version will fix it.
Hi @c19354837
Thanks a lot for your investigations ! I will find a device with a SIM card.
I think you can add this to the README π