Git Product home page Git Product logo

gtm-http-fetcher's Introduction

Google Toolbox for Mac - HTTP Fetcher

Project site https://github.com/google/gtm-http-fetcher
Discussion group http://groups.google.com/group/google-toolbox-for-mac

GTM HTTP Fetcher makes it easy for Cocoa applications to perform http operations. The fetcher is implemented as a wrapper on NSURLConnection, so its behavior is asynchronous and uses operating-system settings on iOS and Mac OS X.

NOTE: Because NSURLConnection is deprecated as of iOS 9 and OS X 10.11, this class has been superseded by GTMSessionFetcher.

Features include:

  • Simple to build; only one source/header file pair is required
  • Simple to use: takes just two lines of code to fetch a request
  • Callbacks are delegate/selector pairs or blocks
  • Flexible cookie storage
  • Caching of ETagged responses, reducing overhead of redundant fetches
  • Automatic retry on errors, with exponential backoff
  • Support for generating multipart MIME upload streams
  • Easy, convenient logging of http requests and responses
  • Fully independent of other projects

To get started with GTM HTTP Fetcher and the Objective-C Client Library, read the wiki.

If you have a problem, please join the GTM discussion group or submit an issue.

gtm-http-fetcher's People

Contributors

csvenja avatar gmrobbins avatar perotinus avatar thomasvl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gtm-http-fetcher's Issues

GTMHTTPFetcher JSON

Hi i need to read google account contacts.

I successfully able use OAuth.

and I'm doing blow code to read contacts. but issue is i'm getting row data.

How can i get json output?

 NSString *urlString = @"https://www.google.com/m8/feeds/contacts/default/full";

GTMHTTPFetcher* fetcher = [GTMHTTPFetcher fetcherWithURLString:urlString];
                fetcher.authorizer = oAuth;
                [fetcher beginFetchWithDelegate:self didFinishSelector:@selector(receivedResponse:WithData:error:)];


output I'm getting is <3c3f786d 6c207665 7273696f 6e3d2731 2e302720 656e636f 
64696e67 3d275554 462d3827 3f3e3c66 65656420 786d6c6e 7.....>

how i can get json output using GTMHTTPFetcher? is it possible?

need your help please.

Original issue reported on code.google.com by [email protected] on 12 Jan 2012 at 5:20

Unable to use in iOS App Extension due to sharedApplication

What steps will reproduce the problem?

1. Create an iOS app and app extension using Xcode
2. Follow instructions to use Endpoints in iOS client: 
https://cloud.google.com/appengine/docs/python/endpoints/consume_ios
3. Include Google API Obj-C Client in app extension

What is the expected output? What do you see instead?

To be able to use the client / endpoints API inside an App Extension

Instead, I get the following error when trying to build:

GTMHTTPFetcher.m: 'sharedApplication' is unavailable: not available on iOS (App 
Extension) - Use view controller based solutions where appropriate instead.

What version of the product are you using? On what operating system?

Xcode: 6.1.1
iOS: 8
Mac: 10.10.1

Please provide any additional information below.

It works properly in the main app, just not in an app extensions

Original issue reported on code.google.com by [email protected] on 15 Jan 2015 at 11:43

GTM_NONNULL breaks other Google repositories

What steps will reproduce the problem?
1. Download http://code.google.com/p/google-api-objectivec-client (which 
downloads http fetcher as external repository)
2. Try to compile it
3. Broken - missing GTM_NONNULL definition from GTMHTTPUploadFetcher.h

What is the expected output? What do you see instead?
Should compile just fine.

What version of the product are you using? On what operating system?
Latest and greatest SVN code. 

Seems that revision 115 removed the macro partially. 

Original issue reported on code.google.com by [email protected] on 8 Feb 2013 at 9:52

An SSL error has occurred and a secure connection to the server cannot be made. error is seen in iOS 10 devices.

we're GTMHTTPFecther class in my project and it was working fine until iOS 9.3 version. After upgrade to iOS 10 we're seeing SSL connection issues and unable to fetch the data.
Is there anything i need to change in gtm-http-fecther class to support iOS 010?
this is the error we're seeing:
An SSL error has occurred and a secure connection to the server cannot be made., _kCFStreamErrorDomainKey=3
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802).
We're using TLS1.0 on the server side with SHA-1 connection. I've added all the ATS exceptions to plist file but still no luck.
Any help would be appreciated.

ignore image files on logging

What steps will reproduce the problem?
1. [GTMHTTPFetcher setLoggingEnabled:YES];
2. many request on load image from google photo

What is the expected output? What do you see instead?

NSPOSIXErrorDomain Code=24 "The operation couldn't be completed. Too many open 
files"

What version of the product are you using? On what operating system?

v99, iOS 5.0

Please provide any additional information below.

I need to load photos on google photo. When the flag of logging is enable, 
logger will save image data and other to iOS device.

But iOS device can't open too many files in a short time, That I got error.

I need a way to setup a ignore list for GTMHTTPFetcherLogging, which data need 
to ignore or log.

Original issue reported on code.google.com by superbil on 5 Mar 2012 at 10:06

iOS 5 compatibility issues

What steps will reproduce the problem?
1. Build and Analyze against iOS 5 
2.
3.

What is the expected output? What do you see instead?
No static analyzer warnings

What version of the product are you using? On what operating system?
OS: Snow Leopard
Using previous version of the fetcher

Please provide any additional information below.
By adding NSURLConnectionDelegate and NSURLConnectionDataDelegate protocols to 
GTHHttpFetcher.h resolves the static analyzer warnings.

Original issue reported on code.google.com by [email protected] on 5 Aug 2011 at 4:51

Put method

Would be cool if there would be a possibility to send some data via put and not 
only via post!

Original issue reported on code.google.com by [email protected] on 17 Sep 2010 at 7:19

Build With LLVM 4.0 will has error

What steps will reproduce the problem?
1. download gdata-objectivec-client r726
2. build it 
3. get error on build result

What is the expected output? What do you see instead?

src/gdata-objectivec-client-read-only-svn/Source/HTTPFetcher/GTMHTTPUploadFetche
r.m:463:55: error: format specifies type 'unsigned long' but the argument has 
type 'NSUInteger' (aka 'unsigned int') [-Werror,-Wformat]
    rangeStr = [NSString stringWithFormat:@"bytes */%lu", dataLen];
                                                    ~~^   ~~~~~~~
                                                    %u
src/gdata-objectivec-client-read-only-svn/Source/HTTPFetcher/GTMHTTPUploadFetche
r.m:469:44: error: format specifies type 'unsigned long' but the argument has 
type 'NSUInteger' (aka 'unsigned int') [-Werror,-Wformat]
    NSAssert2(offset < dataLen, @"offset %lu exceeds data length %lu",
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S
DKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSExce
ption.h:135:71: note: expanded from macro 'NSAssert2'
#define NSAssert2(condition, desc, arg1, arg2) NSAssert((condition), (desc), 
(arg1), (arg2))
                                                                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S
DKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSExce
ption.h:102:40: note: expanded from macro 'NSAssert'
                lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \
                                                 ^        ~~~~~~~~~~~
src/gdata-objectivec-client-read-only-svn/Source/HTTPFetcher/GTMHTTPUploadFetche
r.m:469:68: error: format specifies type 'unsigned long' but the argument has 
type 'NSUInteger' (aka 'unsigned int') [-Werror,-Wformat]
    NSAssert2(offset < dataLen, @"offset %lu exceeds data length %lu",
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S
DKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSExce
ption.h:135:71: note: expanded from macro 'NSAssert2'
#define NSAssert2(condition, desc, arg1, arg2) NSAssert((condition), (desc), 
(arg1), (arg2))
                                                                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S
DKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSExce
ption.h:102:40: note: expanded from macro 'NSAssert'
                lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \
                                                 ^        ~~~~~~~~~~~
src/gdata-objectivec-client-read-only-svn/Source/HTTPFetcher/GTMHTTPUploadFetche
r.m:489:53: error: format specifies type 'unsigned long' but the argument has 
type 'NSUInteger' (aka 'unsigned int') [-Werror,-Wformat]
    rangeStr = [NSString stringWithFormat:@"bytes %lu-%lu/%lu",
                                                  ~~^
                                                  %u
src/gdata-objectivec-client-read-only-svn/Source/HTTPFetcher/GTMHTTPUploadFetche
r.m:489:57: error: format specifies type 'unsigned long' but the argument has 
type 'unsigned int' [-Werror,-Wformat]
    rangeStr = [NSString stringWithFormat:@"bytes %lu-%lu/%lu",
                                                      ~~^
                                                      %u
src/gdata-objectivec-client-read-only-svn/Source/HTTPFetcher/GTMHTTPUploadFetche
r.m:489:61: error: format specifies type 'unsigned long' but the argument has 
type 'NSUInteger' (aka 'unsigned int') [-Werror,-Wformat]
    rangeStr = [NSString stringWithFormat:@"bytes %lu-%lu/%lu",
                                                          ~~^
                                                          %u
src/gdata-objectivec-client-read-only-svn/Source/HTTPFetcher/GTMHTTPUploadFetche
r.m:491:48: error: format specifies type 'unsigned long' but the argument has 
type 'NSUInteger' (aka 'unsigned int') [-Werror,-Wformat]
    lengthStr = [NSString stringWithFormat:@"%lu", thisChunkSize];
                                             ~~^   ~~~~~~~~~~~~~
                                             %u
src/gdata-objectivec-client-read-only-svn/Source/HTTPFetcher/GTMHTTPUploadFetche
r.m:728:65: error: format specifies type 'unsigned long' but the argument has 
type 'NSUInteger' (aka 'unsigned int') [-Werror,-Wformat]
    NSString *rangeStr = [NSString stringWithFormat:@"bytes */%lu", dataLen];
                                                              ~~^   ~~~~~~~
                                                              %u
8 errors generated.

What version of the product are you using? On what operating system?

OS: Mac OSX 10.8
Xcode 4.4, LLVM 4.0

Please provide any additional information below.

I got this error on new llvm compiler, use gcc 4.2 will pass it.

It is some about string format error.

Original issue reported on code.google.com by superbil on 27 Jul 2012 at 5:16

Double-logging when using |setShouldDeferResponseBodyLogging:|

What steps will reproduce the problem?
1. Before fetching, call [fetcher setShouldDeferResponseBodyLogging:YES]
2. Fetch something that will result in an error (important, doesn't happen on 
successful fetches).
3. Call [fetcher setShouldDeferResponseBodyLogging:NO] in the completion 
handler.

What is the expected output? What do you see instead?

Expected one log. Got two.

Looks like there are code paths to writing a log that don't check 
|shouldDeferResponseBodyLogging| first. Then when 
|shouldDeferResponseBodyLogging| is set to NO, it logs again.

The second log says "redirected from..." It thinks there's a redirect because 
it sets the |redirectedFromURL_| member variable the first time it logs 
(there's no actual redirect).

Original issue reported on code.google.com by [email protected] on 30 Jul 2013 at 12:35

uploadNextChunkWithOffset:fetcherProperties is bugged for offset and content-range interpretation

What steps will reproduce the problem?
1. upload a zero byte length file

What is the expected output? What do you see instead?
Expected: upload is fine
Actual: Assertion triggered at line 471

What version of the product are you using? On what operating system?
Google API client library, iOS 6

Please provide any additional information below.
The assertion should be "offset <= dataLen" instead of "offset < dataLen"
For the Content-Range value implementation, it should be
    if(thisChunkSize)
      rangeStr = [NSString stringWithFormat:@"bytes %llu-%llu/%llu",
                  (unsigned long long)offset,
                  (unsigned long long)(offset + thisChunkSize - 1),
                  (unsigned long long)dataLen];
    else
      rangeStr = @"bytes */0";
 instead of just
      rangeStr = [NSString stringWithFormat:@"bytes %llu-%llu/%llu",
                  (unsigned long long)offset,
                  (unsigned long long)(offset + thisChunkSize - 1),
                  (unsigned long long)dataLen];
to produce valid value even for zero-length Content-Length

Original issue reported on code.google.com by [email protected] on 29 Jul 2013 at 1:13

Please add semantic version tags

I’ve recently updated GTMHTTPFetcher to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OS X and iOS Xcode projects 
and provides a central repository for iOS/OS X libraries. This makes adding 
libraries to a project and updating them extremely easy and it will help users 
to resolve dependencies of the libraries they use.

However, GTMHTTPFetcher doesn't have any version tags. I’ve added the current 
HEAD as version 0.0.1, but a version tag will make dependency resolution much 
easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for 
resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for 
instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags


Original issue reported on code.google.com by [email protected] on 22 Mar 2013 at 12:40

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.