如何在IOS Swift中检测飞行模式/飞行模式 [英] How to Detect Airplane Mode/ Flight Mode in IOS Swift

查看:301
本文介绍了如何在IOS Swift中检测飞行模式/飞行模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检测天气IPhone是否处于飞行模式,我已经进行了很多研究,但我没有找到直接的方法来实现这一目标. 我的应用"具有拨打电话"功能,当Iphone处于飞行模式时,他无法拨打电话.

I need to detect weather IPhone is in Airplane mode or Not, i have done much research and i found no direct way to achieve that . My App has the functionality of Calling a Number and When an Iphone has Airplane mode he can't call.

所以我需要给他看我的自定义屏幕,以通知启用了飞行模式.

so I need to show him my custom Screen to Notify that Airplane mode is enable.

任何人都可以解释我们如何有效地实现这一目标将是很好的.

it will be good if any one can explain how we can achieve it in an effective way.

推荐答案

这是另一种检测此模式的方法,如下所示,

Here is another way to detect this mode like below,

转到Info.plist->添加此**应用程序使用Wi-Fi(布尔值)是*

go Info.plist -> add this **Application uses Wi-Fi (Boolean) YES*

要进行测试:杀死您的应用程序->开启飞行模式->打开您的应用程序:您应该能够在应用程序中看到警报.

To test: Kill your app -> turn on airplane mode -> open ur app: you should be able to see alert within the app.

这篇关于如何在IOS Swift中检测飞行模式/飞行模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆