Support ASIHTTPRequest - make a donation!

ASIHTTPRequest documentation

Last updated: 26th June 2010 (v1.7)

Using ASIHTTPRequest in an iOS project

1) Add the files

Copy the files you need to your project folder, and add them to your Xcode project. An overview of the ASIHTTPRequest source files appears here.

If you aren't sure which files you need, it's best to copy all the following files:

  • ASIHTTPRequestConfig.h
  • ASIHTTPRequestDelegate.h
  • ASIProgressDelegate.h
  • ASICacheDelegate.h
  • ASIInputStream.h
  • ASIInputStream.m
  • ASIHTTPRequest.h
  • ASIHTTPRequest.m
  • ASIFormDataRequest.h
  • ASIFormDataRequest.m
  • ASINetworkQueue.h
  • ASINetworkQueue.m
  • ASIDownloadCache.h
  • ASIDownloadCache.m

iPhone projects must also include:

  • ASIAuthenticationDialog.h
  • ASIAuthenticationDialog.m
  • Reachability.h (in the External/Reachability folder)
  • Reachability.m (in the External/Reachability folder)

2) Link against CFNetwork, SystemConfiguration, MobileCoreServices, CoreGraphics and zlib

Choose Project -> Edit Active Target from the menu.



Click the plus button in the bottom left of the window.



Choose CFNetwork.framework from the list, and click Add.





Repeat the last two steps to add the following: SystemConfiguration.framework, MobileCoreServices.framework, CoreGraphics.framework and libz.1.2.3.dylib (this will probably be near the bottom of the list, if you're having trouble finding it).

Using ASIHTTPRequest in a Mac OS X project

To use ASIHTTPRequest in a Mac project, you'll need to link against:

  • SystemConfiguration.framework + zlib (as above)
  • CoreServices.framework
    CFNetwork is part of the CoreServices framework on Mac OS X. Unless you are writing a console-based application, your application is probably already setup to link with CoreServices, but if not, simply add CoreServices.framework in the same way as described above.

Building the tests

Before building the tests, first fetch GHUnit from Github:

From the terminal:

$ cd /path/to/asihttprequest/folder
$ git submodule update --init External/GHUnit

Building the tests (Mac)

Switch to the test target, build-clean, and build and run.

Building the tests (iPhone)

  1. Open the GHUnit iPhone project in External/GHUnit/Project-IPhone
  2. Change the Active SDK to Simulator
  3. Change the Active Target to 'GHUnitIPhone (Simulator-3.0)'
  4. Build
  5. Change the Active SDK to Device
  6. Change the Active Target to 'GHUnitIPhone (Device-3.0)'
  7. Build
  8. Change the Active Target to 'CombineLibs (3.0)'
  9. Build
  10. Open the ASIHTTPRequest iPhone Project, and switch to the tests target
  11. Build and run

Some of the tests require additional information to run:

  • To run the S3 tests, you need to specify your S3 access details in the top of ASIS3RequestTests.m
  • To run the proxy tests, you need to specify details of your proxy server, and a PAC file if you want to run the PAC tests. Note that the proxy tests require a proxy server, while all the other tests require that you don't have a proxy server.