cost 284 ms
監控 inte.net 連接時出現 NWPathMonitor 錯誤

[英]NWPathMonitor error when monitoring the internet connection

我正在開發一個 Swift 應用程序,我需要知道設備何時連接到 inte.net,我實現了以下代碼來做到這一點。 調用 function startMonitoring() 時會出現問題。 一切似乎都正常,但我在控制台中收到此錯誤消息 我在網上搜索過,但關於這種錯誤的信息並不多。 任何幫助將非常感激 ...

關於 inte.net 更改的 NWPathMonitor class 問題

[英]Issue with NWPathMonitor class on internet changes

我正在使用NWPathMonitor class 來檢查 inte.net 更改。 但是我在使用它時遇到了問題。 問題是當 inte.net 關閉時,一旦它回來, monitor.pathUpdateHandler就會被調用/通知兩次。 在 inte.net 關閉情況下,它只被調用一次。 那么,我在 ...

為什么 webSocketTask.receive 永遠不會完成以及如何在我的 Swift 應用程序中強制完成?

[英]Why does webSocketTask.receive never complete and how do I force completion in my Swift app?

我有一個 Swift 應用程序,它使用 web 套接字從公共 API 下載股票價格信息。我通過套接字發送消息以訂閱各種股票價格變化,然后等待連續 stream 的消息被接收但是當我關閉wifi 調用消息接收 function,webSocketTask.receive,永不返回。 如何強制中止接收 ...

為什么 path.status 不能在我的 Swift 應用程序中正確報告 .network 連接狀態?

[英]Why doesn't path.status report the network connection status correctly in my Swift app?

我有一些 swift 代碼,它使用網絡框架來檢測網絡連接何時可用。 如果我打開 wifi 並運行我的代碼,我的代碼報告path.status是.satisfied ,如果我然后關閉我的 wifi,我的代碼再次報告path.status是.satisfied 。 但是如果我再次打開我的 wifi, ...

NSNotificationCenter 發布通知不起作用

[英]NSNotificationCenter posting notifications doesn't work

我有一個使用nw_path_monitor_t注冊網絡事件的 func。 我已經提供了回調,它將在網絡事件發生變化時被調用。 在回調中(如下所示),我正在尋找 wifi 事件並向默認通知中心發布通知。 這是 NotificationReceiver 類: 在開始時調用的 Register ...

處理網絡連接問題的最佳方法 - Swift 5

[英]Best Approach for handling Network Connectivity Issue - Swift 5

我試圖使用蘋果提供給我們處理網絡問題的網絡框架來實現網絡連接。 我所做的是: 1.每當應用程序進入活動 state - 我開始監控網絡 2.每當應用程序進入后台 - 我取消監控以降低電池電量的影響每當我將 go 轉到后台並再次返回到應用程序時,我就遇到了這個問題,它不會再次監視,因為我們無法再次分 ...

NWEndPoint:從另一個 VC 獲取網關的 IP 地址時返回 nil

[英]NWEndPoint: it returns nil when getting gateway's IP address from another VC

我已經找到了這個問題的解決方案,請參閱下面的答案。 我定義了一個 func getGatewayInfo()來獲取網關 IP 地址並將其返回給調用者。 但是當我從其他 VC 的viewDidLoad調用這個 func print(NetworkUtility().getGatewayInfo()) ...

為什么當路徑滿足時 NWPathMonitor 不提供路徑更新?

[英]Why does NWPathMonitor not give a path update when the path becomes satisfied?

我有一個名為NetworkPathMonitor的簡單類,如下所示: 盡管在我禁用和啟用 WiFi 時調用了pathUpdateHandler ,但結果並不總是可靠的。 當我禁用 WiFi 時,當前路徑unsatisfied (No network route) ,但是當我再次啟用 WiFi 時 ...

iOS14 上 NWPathMonitor 中的內存泄漏

[英]Memory Leak in NWPathMonitor on iOS14

我剛剛在NWPathMonitor上使用NWPathMonitor時發現了可重現的內存泄漏。 也可以在 iOS13 上重現,我懷疑 12 也是如此,但只能測試 iOS 13。 要重現泄漏,您所要做的就是分配NWPathMonitor一個實例(無需持有對它的引用),一旦這樣做,您將在使用 Leaks ...

為什么網絡狀態沒有迅速更新?

[英]Why network status does not get updated in swift?

我正在使用 iOS 12 中引入的新“網絡”庫,但我無法弄清楚為什么在用戶連接后網絡狀態沒有更新為 .satisfied。 這是到目前為止的代碼: 為了在模擬器中復制丟失的連接情況,我在視圖加載之前關閉了 wifi 連接,當警報出現時,點擊重試。 令人驚訝的是,重試后的狀態保持不滿意。 為什么 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM