Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

iOS Multitasking support #126

Closed
wants to merge 54 commits into from

2 participants

Zac Bowling Mattt Thompson
Zac Bowling

We added support for iOS multitasking in our branch. It's completely optional by setting requestOperation.attemptToContinueWhenAppEntersBackground = YES;

Commit seatme/AFNetworking@d56f873 has most of the changes. This is a little more tricky of a patch to integrate upstream because it's dependent on the changes we made to handle success/failure callbacks but in your model, you could solve this possibly in the base version of setCompletionBlockWithSuccessBlock:FailureBlock concept (actually I don't know if this is in base class like us but it could be).

Originally we did this at the AFURLRequestOperation level but we moved it up to the AFHTTPRequestOperation level because we want to make sure that the the task is ended after the success and failure callbacks have returned to give the caller a chance to something before allowing the app to shut down. You could move it back down to AFURLRequstionOperation by handling the endBackgroundTask call in the completionBlock but that may not work in your model since you should really end the task after the dispatched async callback for the success and failure blocks so they have a chance to run.

Either way. Interesting changes I wanted share upstream.

zbowling and others added some commits
Zac Bowling zbowling async fixes. changes for json d3af887
Zac Bowling zbowling I fixed something e1d89f8
Zac Bowling zbowling small change' dd84bad
Zac Bowling zbowling better foundation json support ef5bf73
Zac Bowling zbowling Merge branch 'merge_foundation_json' of github.com:seatme/AFNetworking
Conflicts:
	AFNetworking/AFHTTPClient.m
	AFNetworking/AFHTTPRequestOperation.m
	AFNetworking/AFJSONRequestOperation.m
	AFNetworking/AFXMLRequestOperation.m
	AFNetworking/NSString+AFNetworking.h
	Example/Classes/AFGowallaAPIClient.h
	Mac Example/AppDelegate.h
	Mac Example/AppDelegate.m
	Mac Example/Classes/AFGowallaAPIClient.h
	iOS Example/Classes/AFGowallaAPIClient.h
521fd35
Zac Bowling zbowling brought to much over in the merge d55245e
Zac Bowling zbowling better JSON support 2c0ef65
Zac Bowling zbowling better idea e42d89d
Zac Bowling zbowling class custer method 23ac76c
Zac Bowling zbowling should be self d6ffe69
Zac Bowling zbowling much much better ec9a8b0
Zac Bowling zbowling moved this to the same file 54f90d4
Zac Bowling zbowling moved this to the same file b3cf84e
Zac Bowling zbowling merged in upstream changes 6c1cd78
Zac Bowling zbowling Merge branch 'experimental-0.8' of https://github.com/gowalla/AFNetwo…
…rking

Conflicts:
	AFNetworking/AFHTTPClient.m
	AFNetworking/AFHTTPRequestOperation.h
	AFNetworking/AFHTTPRequestOperation.m
	AFNetworking/AFJSONRequestOperation.h
	AFNetworking/AFJSONRequestOperation.m
	AFNetworking/AFPropertyListRequestOperation.h
	AFNetworking/AFPropertyListRequestOperation.m
	AFNetworking/AFXMLRequestOperation.h
	AFNetworking/AFXMLRequestOperation.m
e5e6f97
Zac Bowling zbowling fixed a lot of various changes after the merge. much better bb96088
Zac Bowling zbowling forgot to mark this as concurrent. a3c3322
Zac Bowling zbowling self is never delegate. don't unset the delegate if someone else want…
…ed to be the delegate.
1511a45
Zac Bowling zbowling no such thing as an error here. 1cfe657
Zac Bowling zbowling comments. 70fd2d8
Zac Bowling zbowling dead property 9834ad4
Zac Bowling zbowling comments 932d710
Zac Bowling zbowling Foundation json should be last. 2a939e5
Zac Bowling zbowling conventions and leaks 9a6d541
Zac Bowling zbowling Merge branch 'experimental-0.8' of https://github.com/gowalla/AFNetwo…
…rking

Conflicts:
	AFNetworking/AFJSONUtilities.h
bcbf99c
Zac Bowling zbowling Merge branch 'experimental-0.8' of https://github.com/gowalla/AFNetwo…
…rking

Conflicts:
	AFNetworking/AFHTTPClient.m
a0a83a6
Zac Bowling zbowling fix path of this. a9e645d
Zac Bowling zbowling Pull this change in from other branch daaba29
Zac Bowling zbowling Merge github.com:seatme/AFNetworking b4335c0
Mattt Thompson mattt Updating README to point to new AFNetworking URL (https://github.com/… 920b01d
Zac Bowling zbowling Fix memory leak ccfcd43
Zac Bowling zbowling Merge branch 'master' of github.com:zbowling/AFNetworking e86aa7a
Zac Bowling zbowling Merge branch 'master' of git://github.com/gowalla/AFNetworking
Conflicts:
	AFNetworking/AFHTTPClient.m
	AFNetworking/AFImageRequestOperation.h
	AFNetworking/AFImageRequestOperation.m
	AFNetworking/AFJSONRequestOperation.h
	AFNetworking/AFXMLRequestOperation.m
1d12038
Zac Bowling zbowling much better solution 9088768
Zac Bowling zbowling change upstream and merge 11057cf
Zac Bowling zbowling fix a few lingering issues after the merge b3fb0bb
Zac Bowling zbowling new README 695ea9c
Zac Bowling zbowling New README for specifying the changes in our fork. 8dd9494
Zac Bowling zbowling Update README.md e746bf4
Zac Bowling zbowling Remove silly, overly paranoid code in setCompletionBlock and let the …
…parent have a say in the isReady process so it can check dependent NSOperations.
23ca8b4
Zac Bowling zbowling add support for iOS multitasking. 16b5839
Zac Bowling zbowling Merge branch 'master' of github.com:seatme/AFNetworking f1cb7aa
Zac Bowling zbowling Update README.md 87feccd
Zac Bowling zbowling move multitasking support up to AFHTTPURLRequest d56f873
Zac Bowling zbowling Merge branch 'master' of github.com:seatme/AFNetworking 552e0cf
Zac Bowling zbowling add cache policy support e2e14cc
Zac Bowling zbowling update readme c40ff8f
Zac Bowling zbowling unnecessary cast. d40e197
Zac Bowling zbowling Operation shouldn't finish until after the operations finish processi…
…ng their responses. Dependent operations may need the response after one has completed. This also simplifies things a little.
11159ee
Zac Bowling zbowling A much improved design, taking cues from NSBlockOperation. 76c33a9
Zac Bowling zbowling autorelease return. fix regression. d2cc7af
Zac Bowling zbowling Update README.md 15264db
Zac Bowling zbowling Merge branch 'master' of github.com:seatme/AFNetworking 2449e59
Zac Bowling zbowling should move to finished if canceled and just started f312dde
Mattt Thompson
Owner

Thanks for sharing these changes. I'm not sure if this functionality wouldn't be better-suited for AFHTTPClient. The current solution for backgrounding involves 3 lines in the app delegate, as described in this StackOverflow question. I'd consider making this a property of the client, which would make it a bit easier and more obvious—especially for new users.

Zac Bowling

you're right. we have a better approach. going to push it later.

Zac Bowling zbowling closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 22, 2011
  1. Zac Bowling

    async fixes. changes for json

    zbowling authored
Commits on Sep 27, 2011
  1. Zac Bowling

    I fixed something

    zbowling authored
Commits on Oct 7, 2011
  1. Zac Bowling

    small change'

    zbowling authored
Commits on Oct 17, 2011
  1. Zac Bowling
Commits on Oct 18, 2011
  1. Zac Bowling

    Merge branch 'merge_foundation_json' of github.com:seatme/AFNetworking

    zbowling authored
    Conflicts:
    	AFNetworking/AFHTTPClient.m
    	AFNetworking/AFHTTPRequestOperation.m
    	AFNetworking/AFJSONRequestOperation.m
    	AFNetworking/AFXMLRequestOperation.m
    	AFNetworking/NSString+AFNetworking.h
    	Example/Classes/AFGowallaAPIClient.h
    	Mac Example/AppDelegate.h
    	Mac Example/AppDelegate.m
    	Mac Example/Classes/AFGowallaAPIClient.h
    	iOS Example/Classes/AFGowallaAPIClient.h
  2. Zac Bowling
Commits on Oct 21, 2011
  1. Zac Bowling

    better JSON support

    zbowling authored
  2. Zac Bowling

    better idea

    zbowling authored
  3. Zac Bowling

    class custer method

    zbowling authored
  4. Zac Bowling

    should be self

    zbowling authored
Commits on Oct 22, 2011
  1. Zac Bowling

    much much better

    zbowling authored
  2. Zac Bowling

    moved this to the same file

    zbowling authored
  3. Zac Bowling

    moved this to the same file

    zbowling authored
Commits on Nov 8, 2011
  1. Zac Bowling

    merged in upstream changes

    zbowling authored
  2. Zac Bowling

    Merge branch 'experimental-0.8' of https://github.com/gowalla/AFNetwo…

    zbowling authored
    …rking
    
    Conflicts:
    	AFNetworking/AFHTTPClient.m
    	AFNetworking/AFHTTPRequestOperation.h
    	AFNetworking/AFHTTPRequestOperation.m
    	AFNetworking/AFJSONRequestOperation.h
    	AFNetworking/AFJSONRequestOperation.m
    	AFNetworking/AFPropertyListRequestOperation.h
    	AFNetworking/AFPropertyListRequestOperation.m
    	AFNetworking/AFXMLRequestOperation.h
    	AFNetworking/AFXMLRequestOperation.m
  3. Zac Bowling
  4. Zac Bowling
  5. Zac Bowling
  6. Zac Bowling
  7. Zac Bowling

    comments.

    zbowling authored
  8. Zac Bowling

    dead property

    zbowling authored
  9. Zac Bowling

    comments

    zbowling authored
  10. Zac Bowling
Commits on Nov 9, 2011
  1. Zac Bowling

    conventions and leaks

    zbowling authored
  2. Zac Bowling

    Merge branch 'experimental-0.8' of https://github.com/gowalla/AFNetwo…

    zbowling authored
    …rking
    
    Conflicts:
    	AFNetworking/AFJSONUtilities.h
  3. Zac Bowling

    Merge branch 'experimental-0.8' of https://github.com/gowalla/AFNetwo…

    zbowling authored
    …rking
    
    Conflicts:
    	AFNetworking/AFHTTPClient.m
  4. Zac Bowling

    fix path of this.

    zbowling authored
  5. Zac Bowling
  6. Zac Bowling
Commits on Nov 11, 2011
  1. Mattt Thompson
Commits on Nov 16, 2011
  1. Zac Bowling

    Fix memory leak

    zbowling authored
  2. Zac Bowling
  3. Zac Bowling

    Merge branch 'master' of git://github.com/gowalla/AFNetworking

    zbowling authored
    Conflicts:
    	AFNetworking/AFHTTPClient.m
    	AFNetworking/AFImageRequestOperation.h
    	AFNetworking/AFImageRequestOperation.m
    	AFNetworking/AFJSONRequestOperation.h
    	AFNetworking/AFXMLRequestOperation.m
  4. Zac Bowling

    much better solution

    zbowling authored
Commits on Nov 22, 2011
  1. Zac Bowling

    change upstream and merge

    zbowling authored
  2. Zac Bowling
  3. Zac Bowling

    new README

    zbowling authored
  4. Zac Bowling
  5. Zac Bowling

    Update README.md

    zbowling authored
  6. Zac Bowling

    Remove silly, overly paranoid code in setCompletionBlock and let the …

    zbowling authored
    …parent have a say in the isReady process so it can check dependent NSOperations.
  7. Zac Bowling
  8. Zac Bowling
  9. Zac Bowling

    Update README.md

    zbowling authored
Commits on Nov 23, 2011
  1. Zac Bowling
  2. Zac Bowling
  3. Zac Bowling

    add cache policy support

    zbowling authored
  4. Zac Bowling

    update readme

    zbowling authored
  5. Zac Bowling

    unnecessary cast.

    zbowling authored
  6. Zac Bowling

    Operation shouldn't finish until after the operations finish processi…

    zbowling authored
    …ng their responses. Dependent operations may need the response after one has completed. This also simplifies things a little.
Commits on Nov 24, 2011
  1. Zac Bowling
  2. Zac Bowling
  3. Zac Bowling

    Update README.md

    zbowling authored
  4. Zac Bowling
  5. Zac Bowling
Something went wrong with that request. Please try again.