使用Network Link Conditioner來減慢你網絡速度
Xcode 14.0, swift 5.7, iOS 16.0
2022-09-13
有時我們需要測試在網絡速度不好的情況下App的反應,以便做好在這種情況下的應對措施。Apple提供了一個叫Network Link Conditioner的軟體,它可以模擬在不同情況之下的網速,比如3G。

1. 在
https://developer.apple.com/download/all/下載Additional Tools for Xcode 14,因為我使用的是Xcode 14(所以請下載與Xcode相應的版本):

2. 運行Hardware-->Network Link Conditioner.prefPane,步驟如下:




3. 為了測試速度,這里使用
在SwiftUI 如何在URLSessionDownloadTask中實現Pause、Resume、Cancel等功能所做的App來演示在正常網速和使用Network Link Conditioner模擬的3G網速的分別(使用Network Link Conditioner後記得將其關掉,不然你的上網將會是3G ^_^):
正常網速
3G網速