Skip to content
Ali Shatergholi edited this page Jan 17, 2019 · 2 revisions

Welcome to the vaslAppSdk wiki!

Services

vaslAppSdk is a universal framework to bring you a new experience of programming. We have different services to make your app special , reliable , fast and entertaining. We provide you subscription , analytic , charge , billing , game and league, content , geo and much more services to help you to creating great and complex apps. Vaslapp ios sdk web services made by google protocol buffer technology and assurance security and speed.

Initialization

First of all you should Import vaslAppSdk to your class to use our framework.

import vaslAppSdk

then create an object by instantiating a variable from vaslAppSdk and initialize it.

var sdk : vaslAppSdk!

Now you need to initialize this object to access to our services and web services.

sdk = vaslAppSdk.init(appId: “YOUR APPLICATION ID”, baseUrl: “example.vaslapp.com”, clientId: “YOUR CLIENT ID” ,  clientSecret: “YOUR CLIENT SECRET KEY”, username: “YOUR USERNAME”, password: “YOUR PASSWORD”)

By registering your app in vaslapp.com you’ll receive some unique keys and you need to implement them in your application. Those keys are appId , clientId , clientSecret , username and password baseUrl is your subdomain in vaslapp.com to login into your management panel. You need to fill all values correctly to receive data from vaslapp web services.

Now you can access vaslAppSdk services and functions from your instantiated object First you should select your service and then use a function.

Example

sdk.analyticService().FUNCTION

Usage example

After finishing initialization , you can use vaslapp services. For example if You want to set up operator login/register method into your app, First , you need to call “SubscriberService” service and then use “registerOperatorSubscriber” function like this

sdk.SubscriberService().registerOperatorSubscriber(mobile: String) { (data, error) in
                    if error == nil {
                   //your code to navigate to another view controller 
                    }else{
                        print(error!)
                    }
  • Data and error are function completions and you can name them everything you want

  • Data is the result of web service

In next step , you need to validate your phone number with activation code which sent to your phone to activate your user and get sessionId so you need to call “validateOperatorSubscriber” method like this :

 sdk.SubscriberService().validateOperatorSubscriber(activationKey:String, mobile: String) { (data, error) in
            // handling method completion
            if error == nil {
                if let info = data?.loginInfo{
                    // user is an example core data class to store user data 
                    // loginInfo is a method in user class which stores user data in core data
                    self.user.loginInfo(info)
                    if self.user.insertDataBase(){
                     print(“information saved”)
                    }
                }
            }else{
                print(error!)
            }

By handling method completion you’ll receive data from web services and you need to store some critical data like sessionId into your database.

Clone this wiki locally