step 1: Take the url file you download and configure it using NSURLSession and its dataTaskWithUrl method.
Step 2: Integrate the NSURLSessionDelegate, NSURLSessionDataDelegate into your controller.
Step 3: Take two CFAbsoluteTime variables that store starTime and assign CFAbsoluteTimeGetCurrent() and a second stopTime in the didReceiveData: delegation method.
Step 4: Copy the speed as follows
CFAbsoluteTime elapsedTime = stopTime - startTime; float speedOfConnection = elapsedTime != 0 ? [data length] / (stopTime - startTime) / 1024.0 / 1024.0 : -1;
Bhavik patel
source share