App42 Shephertz integration for iOS
Shephertz is a cloud ecosystem for apps and games. It works on cross-platforms.
The App42 Cloud APIs consist of a REST based service, which has both JSON and XML interface. There are around 20+ modules with over 400+ APIs which will help us to develop our applications irrespective of the type or domain of the App we are developing. App42 Cloud API provides technical as well as business services.
It is used for App development successful on the Cloud, irrespective on which technology or platform we are developing. An App’s complete backend will be managed by App42 platform. We hardly need to write any server side code for our Apps. And thus we don’t have to worry about OS installations and patches, security, firewalls, scalability, high availability and server side technical and business logic.
We can just focus on our UI, UX and logics and leave the cloud and data management to it. Moving from one access channel i.e. Mobile, Web, Social, SaaS etc. to another will be greatly reduced because of unified approach.
These APIs are platform agnostic and support Windows 7, J2ME, iOS, Android or HTML5 with all popular languages like Java, Groovy, PHP, Ruby, or C# which will enable easy integration of the APIs into the App code. With just a few lines of code, the we can get access to the services. From a simple to complex app can be developed using our comprehensive and powerful technical as well as business services.
Now further we will discussing about MBaaS(Mobile backend as a service) by shephertz.
- Lets create an account with shephertz at api.shephertz.com
- It will ask you to create an app as you login (attaching the screenshot for the same)
Please Note: Your app name should be unique.
- Then Copy Paste your API key and Scret Key for further reference also choose a platform on which you want to create an app i.e. iOS.
- Download The SDK’s
- Unzip the downloaded file on your local system, the unzipped folder contains docs and a sample
- Drag Shephertz_App42_iOS_API.framework into your Xcode project and drop under your project.Make sure “Copy items into destination group’s folder” check-box is checked.
- Add the following libraries:
- CoreTelephony.framework
- SystemConfiguration.framework
- CoreLocation.framework
- Select your service that you want to use like User management, App data, Push notification, Social Integration etc.
- Add key “NSLocationWhenInUseUsageDescription” to your info.plist.
To initialize the SDK you need to pass API key and secret key in your AppDelegate class as following:
(void)applicationDidBecomeActive:(UIApplication *)application
{
[App42API initializeWithAPIKey@”<UR_API_KEY”>andSecretKey:@"<YOUR_SECRET_KEY>];
}
- Now when everything is initiated, you can use any service using following code:
UserService *userService = [App42API buildUserService];
//Build Storage Service
StorageService *storageService = [App42API buildStorageService];
- Two classes that we basically use with Shephertz are
- user management
- saving Data
- Steps for user management:
NSString *userName = @"TTN";
NSString *pwd = @"*****";
NSString *emailId = @"ttn@tothenew.com";
User *user = [userService createUser:userName password:pwd emailAddress:emailId];
You can also add more parameters for user and make it dynamic.
App42 provides an easy interface to save app data in the form of JSON objects using their Storage API. The JSON app data is saved inside a given collection and database. Here collection is like a table and your
JSON object represents a row inside that collection. Your App can have only a single db and as many collections inside it.
Once your JSON object is saved in the App42 Cloud, you can query your stored objects using query interface.
- Steps For saving data:
NSString *dbName = @"TTNApp";
NSString *collectionName = @"TTN";
NSString *json = @{\"name\":\"ABC\",\"age\":25,\"phone\":\"9999999999 \"};
Storage *storage = [storageService insertJSONDocument:dbName collectionName:collectionName json:json];
NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) // This will have only single object stored above
{
NSLog(@"objectId is = %@ " , jsonDoc.docId);
NSLog(@"Created At = %@ " , jsonDoc.createdAt); }
Please note: If you use unique collection name and database name a new database will be created so make sure when you want to append the data you use same details.
So this is how you can easily use the Shephertz MBaas without thinking about backend and just writing few lines of code.
As we always know that everything comes with some pros and cons and so this do.
But before I would like to conclude that for the clients who wants to invest with shephertz and make their app using the same I would like you to consider some points.
- All we want through a web service may not be present in a single API, so there is a possibility that to achieve a single task of our interest we may need to hit various services which can be created in a single API if we build our own server.
- This service came in various package rates specifying below
Small – $0/mo
Medium – $99/mo,
Large – $100/mo.
(for more bug enterprise the service provider must be contacted.)
And according to the plan one takes, the services is provided, specified below:
Small package does not include – Map-reduce jobs, Dedicated account manager, Phone support, Dedicated tech support, integration support, customized pricing plan, Private hosting .
Medium package does not include – Phone support, Dedicated tech support, integration support, customized pricing plan , Private hosting .
Large package does not include – integration support, customized pricing plan, Private hosting.
I hope this would be helpful for you.
nice blog…