Code Monkey home page Code Monkey logo

freesound-ios's Introduction

Freesound-iOS

iOS/Objective-c client to interface with the Freesound APIv2 and sample iPhone application.

This client only provides functions to interface with basic Freesound APIv2 resources. OAuth2 required resources are not yet supported. Check the Freesound API docummentation here: www.freesound.org/docs/api.

How to use

Set up the client files in your project:

  1. Add the 'Freesound-iOS' folder of this repositiry to your project tree.

  2. Request a Freesound API key at www.freesound.org/apiv2/apply.

  3. Edit the file 'FreesoundAPIKey.example.h' and add your api key.

  4. Rename 'FreesoundAPIKey.example.h' to 'FreesoundAPIKey.h'.

After setting up, you can include 'Freesound-iOS.h' in your view controllers and use the functions provided by the client. Freesound-iOS defines a series of functions that return NSURL* objects to access several Freesound APIv2 resources. You can use these urls to perform requests yourself.

Alternatively, the client provides three functions that can handle the request for you and may easy up things in some situations. These functions are:

  • fetchURL:(NSURL *)url

Retrieves the contents given by the NSURL* object and return them as an NSDictionary*. This method is synchronous therefore if used as is it will block your current queue (not recommended!).

  • fetchURL:(NSURL *)url withCompletionHandler:(void(^)(NSDictionary *results))handler

Retrieves the contents given by the NSURL* object performing the request asynchronously (thus non blocking your current queue). Once response is received, the block ('withCompletionHandler') is executed on the main queue. This block has a parameter ('results') that contains an NSDictionary* with the contents of the response.

  • fetchURL:(NSURL *)url withCompletionHandler:(void(^)(NSDictionary *results))handler onQueue:(dispatch_queue_t)queue

Retrieves the contents given by the NSURL* object performing the request asynchronously (thus non blocking your current queue). Once response is received, the block ('withCompletionHandler') is executed on the queue specified in the function call ('onQueue'). This block has a parameter ('results') that contains an NSDictionary* with the contents of the response.

The NSDictionary* with the results returned in any of the above functions will return 'nil' if no response is successfully obtained from the request. Note that these functions do not correctly do error handling and are only intented to help you getting started with the api. Use them with care ;)

freesound-ios's People

Contributors

catchakos avatar ffont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.