• Stars
    star
    1,051
  • Rank 43,859 (Top 0.9 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A progressive download operation for AFNetworking.

AFDownloadRequestOperation

  • DEPRECATED AND NO LONGER MAINTAINED. USE NSURLSession instead. *

A progressive download operation for AFNetworking. I wrote this to support large PDF downloads in PSPDFKit, my commercial iOS PDF framework, but it works for any file type.

While AFNetworking already supports downloading files, this class has additional support to resume a partial download, uses a temporary directory and has a special block that helps with calculating the correct download progress.

AFDownloadRequestOperation is smart with choosing the correct targetPath. If you set a folder, the file name of the downloaded URL will be used, else the file name that is already set.

AFDownloadRequestOperation also relays any NSError that happened during a file operation to the faulure block.

With partially resumed files, the progress delegate needs additional info. The server might only have a few totalByesExpected, but we wanna show the correct value that includes the previous progress.

    [pdfRequest setProgressiveDownloadProgressBlock:^(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile) {
        self.downloadProgress = totalBytesReadForFile/(float)totalBytesExpectedToReadForFile;
    }];

The temporary folder will be automatically created on first access, but an be changed. It defaults to <app directory>tmp/Incomplete/. The temp directory will be cleaned by the system on a regular bases; so a resume will only succeed if there's not much time between.

AFNetworking

This is tested against iOS 6+, AFNetworking 2.0 and uses ARC.

Creator

Peter Steinberger @steipete

License

AFDownloadRequestOperation is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

Aspects

Delightful, simple library for aspect oriented programming in Objective-C and Swift.
Objective-C
8,383
star
2

PSTCollectionView

Open Source, 100% API compatible replacement of UICollectionView for iOS4.3+
Objective-C
2,546
star
3

PSStackedView

open source implementation of Twitter/iPad stacked ui - done right.
Objective-C
1,970
star
4

InterposeKit

A modern library to swizzle elegantly in Swift.
Swift
962
star
5

PSPDFTextView

A subclass of UITextView that fixes the most glaring problems from iOS 7 and 7.1.
Objective-C
877
star
6

PSTAlertController

API similar to UIAlertController, backwards compatible to iOS 7. Will use the new shiny API when you run iOS 8.
Objective-C
737
star
7

PSPushPopPressView

Zoom, Rotate, Drag – everything at the same time. A view-container for direct manipulation, inspired by Our Choice from Push Pop Press.
Objective-C
611
star
8

PSFoundation

Categories and helper classes for iOS projects.
Objective-C
569
star
9

PSTDelegateProxy

A simple proxy that forwards optional methods to delegates - less boilerplate in your code!
Objective-C
256
star
10

PSYouTubeExtractor

Display YouTube URLs in a MPMoviePlayerController
Objective-C
191
star
11

PSMenuItem

A block based UIMenuItem subclass.
Objective-C
179
star
12

UIKitDebugging

A set of files that enables various debug flags in UIKit
Objective-C
178
star
13

PSPDFKit-Demo

A drop-in-ready framework that helps in almost every aspect of PDF-rendering on iOS.
Objective-C
178
star
14

PSiOSAppTemplate

iOS Application Template with JSON-Parsing, AutoUpdating, CrashReporter+Sender, Statistics, custom Logging, Localization and all those little things already set up, ready for you to make awesome stuff!
Objective-C
174
star
15

PSAlertView

Modern block-based wrappers for UIAlertView and UIActionSheet.
Objective-C
129
star
16

PSStoreButton

UIButton that is styled like iPhone's AppStore-Button. No Images used!
Objective-C
91
star
17

PSTCenteredScrollView

Shows off different ways to center content in a UIScrollView.
Objective-C
79
star
18

NSLogger-CocoaLumberjack-connector

65
star
19

xcode-theme-solarized-modded

Heavily modded theme based on the Solarized style: http://ethanschoonover.com/solarized/
49
star
20

iOS6-Runtime-Headers

6.0 (GM)
Objective-C
47
star
21

speaking

Upcoming and past speaking engagements for Peter Steinberger (@steipete).
47
star
22

OSLogTest

Test app for OSLog
Swift
45
star
23

PSBackgroundCurtain

Fades the App to black/semi-black when in Background. Fully animated.
44
star
24

PSTFoundationBenchmark

Foundation Collection Classes Benchmarks
Objective-C
37
star
25

SwiftUITouchHandling

Testing touch handling from embedded SwiftUI views
Swift
28
star
26

stackoverflowerizer

always redirect to stackoverflow from pages that just copy the content, like efreedom
JavaScript
15
star
27

steipete.com

Personal Website of Peter Steinberger.
SCSS
13
star
28

dotfiles

my dot files for bash, git, rails and co
Shell
4
star