Hover API Rest SDK for Objective-C bindings
Welcome to the Hover SDK for Objective-C, this SDK is for building a robust Objective-C application based on the Hover API. The Hover SDK for Objective-C makes it easy to integrate a full Hover API services into Objective-C apps.
This contains the project of static library to communicate with hover API. Also in include folder are compiled files generated by running the static library. The folder contains the library (libSDK_API_REST.a) and headers (.h files) according to what you require (ios simulator or ios device):
- Debug-iphoneos
- Debug-iphoneSimulator
- Debug-universal
Also contains Configuration.plist file. You need when implement a static library in your project.
This project use JsonModel to make automatically introspects model classes and the structure of JSON input and reduces drastically the amount of code. You can find this library here
We need now to build .a file (compiled library file). We must compile for ios device and for ios simulator (i386 arch)
- Select SDK_API_REST > iOs Device and Build (⌘ + B)
- Select SDK_API_REST > iPhone 7.1 Simulator and Build (⌘ + B)
Note: This project contains a .a file and headers in the include folder.
Localize headers and .a file, it can be two methods:
-
Method A. If you'd like use .a generated when run static library project.
- Expand Products in File Browser view
- Select libSDK_API_REST.a
- Right Button > Show in Finder
- Move up in directory
You must have this hierarchy: * Products/Debug-iphoneos/libSDK_API_REST.a * Products/Debug-iphonesimulator/libSDK_API_REST.a
-
Method B. Use contents of include folder, this folders contains headers and library compiled (.h and .a files).
- Products/Debug-iphoneos/libSDK_API_REST.a
- Products/Debug-iphonesimulator/libSDK_API_REST.a
- Products/Debug-universal/libSDK_API_REST.a
Open your project with finder and create a directory with include name. This folder will be contain the library (libSDK_API_REST.a) and headers inside a folder (SDK_API_REST) like this hierarchy :
- include
- SDK_API_REST
- headers files (.h)
- libSDK_API_REST.a
- SDK_API_REST
-
Add library to your project.
-
Click on the project root node in the project navigator, and select the project name target.
- Select Build Settings, and locate the Header Search Paths setting in the list. You can type "header search” in the search box to filter the big list of settings if necessary.
- Double click on the Header Search Paths item, and a popover will appear. Click the + button, and enter the following: $SOURCE_ROOT/include.
-
Return to the build settings.
- Select the Build Phases tab and expand the Link Binary With Libraries section.
- Click the + button in that section. click on the Add Other button and locate the libSDK_API_REST.a library file in the lib subdirectory inside the project’s root folder.
-
Click on the Build Settings tab, and locate the Other linker Flags setting.
- Click on the + button and type -ObjC.
-
Drag Configuration.plist to your project. In this file you must provide the basic datas to SDK:
- Ckey: private key to API access.
- endPoint: server IP.
- port: port to recieve petitions.
- timeOut: range time to make petition.
- fileTimeOut: when connection is sucessful, range time to read response.
- apiVersion: The HOVER API version.
- user_id: identifier of parent user
- branch_id: branch identifier of parent user
And finally you'll have installed SDK for hover API and is ready for use!! !
All requests to the RESTful API on the SDK are made using a serialized class, so, each request has their own translation from json to class, for example: to register a single user use User class and its attributes instead build a json file.
NOTE: If you want add more attributes to any serialized class, then just extends from the desired class.
All responses from the RESTful API on the SDK are managed by Response class, this class stores the HTTP Status Code, the raw response (json, xml, etc ...) as a string and the body response casted to a desired class. For example if you register a user, then your response instance stores the serialized object, just provide the class to map:
User *userInfo = [[User alloc] initWithDictionary:response.bodyResponseT];
In sample directory you can find a live example project of THE HOVER API integration in iOS App.
You can find more info about courses of how to use the API, SDKs or integration of The Hover into your app, visiting us at: http://www.thehover.com or mail us: thehover@hovanetworks.com