iOS Client

Demostrate you how to revoke backend service.

Prerequisites

  1. Connected iOS device to your Mac.
  2. Create an iOS project with Single View Application:NepenthesClient,Language:Objective-C Devices:Universal.

  3. Download and unzip it.
  4. Drag Nepenthes.framework to the project.
  5. Create Config.plist with the following contents.(Make sure Host and Port are your own specified values. Server is running on your Mac,iPhone will connect to your Mac,so please make sure the Host is the Mac address.)
  6. Xcode iOSClient Project Download

JSON Object

  1. Objective-C JSON Object mapping to backend Schema Object. All the mapping properties should all be NSString type. Create iOS class subclass of AbstractJson
  2. UserJson.h
  3. UserJson.m

BLSync Object

  1. All the Objective-C BL Objects start with BLSync prefix. BL object manipulate json object with backend service. Create BLSyncUser extended from BLSyncAbstract
  2. BLSyncUser.h
  3. BLSyncUser.m
  4. So far your project should looks like

Invoke backend service

  1. In order to make App call server,you need add the following codes to info.plist
  2. We will invoke backend service in ViewController.h and ViewController.m
  3. ViewController.h
  4. ViewController.m (you can uncomment different blocks to test that function)

Summary

Json Object is mapped to backend Schema Object. BLSync Object provides the necessary function to manipulate database via backend service. With the following functions,you can manipulate almost all the operations to the remote database precisely. This chapter show you how to build a block for a sophiscated App.
//insert object to database
-(BOOL)insert:(UserJson *)json;

//delete records by where condition,whereClause is the strings after SQL key word WHERE
-(BOOL)delete:(NSString *)whereClause;

//delete record by ID
-(BOOL)deleteByID:(NSString *)ID;

//update record
-(BOOL)update:(UserJson *)json;

//getCount by where condition
-(NSInteger)getCount:(NSString *)whereClause;

//select all records by where condition
-(NSArray *)select:(NSString *)whereClause;

//select specified records by where condition
-(NSArray *)select:(NSString *)whereClause index:(NSString *)index step:(NSString *)step;

//getJson by ID
-(UserJson *)getJson:(NSString *)ID;
Next:Mac Client