-2
正如我们为iPhone设备所知,我们可以使用“ifaddrs”来监控用户的数据。参考这个链接:“iPhone Data Usage Tracking/Monitoring”,但是如何监控iOS中当前进程的下载数据?获取iOS下载进度
正如我们为iPhone设备所知,我们可以使用“ifaddrs”来监控用户的数据。参考这个链接:“iPhone Data Usage Tracking/Monitoring”,但是如何监控iOS中当前进程的下载数据?获取iOS下载进度
使用NSURLSessionDownloadTask和实现它的委托
-(void)URLSession:(NSURLSession *)session
downloadTask:(NSURLSessionDownloadTask *)downloadTask
didWriteData:(int64_t)bytesWritten
totalBytesWritten:(int64_t)totalBytesWritten
totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
{
NSLog(@"%f/%f", (double)totalBytesWritten,
(double)totalBytesExpectedToWrite);
}
完整的教程可以在这里找到:http://www.raywenderlich.com/51127/nsurlsession-tutorial