gpt4 book ai didi

ios - 没有互联网连接时禁用按钮

转载 作者:行者123 更新时间:2023-11-28 19:22:45 26 4
gpt4 key购买 nike

在 iOS 中没有网络/互联网连接时如何禁用按钮?

最佳答案

查看来自 Apple 的可达性代码。

http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

并像这样使用它:

Reachability *reachabilityInstance = [[Reachability reachabilityForInternetConnection] retain];
[reachabilityInstance startNotifier];
NetworkStatus networkStatus = [reachabilityInstance currentReachabilityStatus];
BOOL connected = (networkStatus==ReachableViaWiFi || networkStatus==ReachableViaWWAN);

关于ios - 没有互联网连接时禁用按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7283309/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com