Simple Badge Tutorial with Playbasis iOS SDK - Part I

In this example project, we will create a simple iOS application to let users perform “like” to Playbasis and get a badge reward back according to the rule set in Playbasis application dashboard.

Part I will explain how to set things up on Playbasis’s dashboard. Part II will guide you through the steps to create a final application with XCode.

Step 1. Sign up at Playbasis

Go to , and click Sign up button.

Then fill out your information, and finally click “Take me to my dashboard” button.

Step 2. Login

If the system didn’t take you to your dashboard, then go to and click at Login button.

Step 3. Creating App

It will inform you to create a new app.

Click “Create App” button, then it will take you to fill out information about your new application.

Fill out information, in this case we will enter with the following information.

  • App Name : PlaybasisTestApp
  • Platform : iOS
  • Bundle ID : com.playbasis.playbasistestapp

In the dashboard, it just created a new application for us.

You will see API Key, and Api Secret, this will be used later when you finally creating and code things out in XCode.

Step 4. Creating a Badge

On the left panel, click on “Rewards”.

Click on “Insert” button.
Enter the following information.

For “General” section.

For “Data” section.

Find a proper like image, and fill out information as shown above.

Let set quantity to high number like 10000. This means, the badge is available to be give for users 10000 times. Finally, click on “Save” button, then we just got a badge set in our app.

Step 5. Creating a Rule

We will create a rule that says “If player did like for 2 consecutives of time, each one within 20 seconds, then we will reward a badge for player.”

Like action is a standard action that it’s already there in the Playbasis’s pre-defined action. Thus we will leverage this and use it in our own application for this project. We can create our own custom action later on, but not this time.

Click on “Engine” on the left panel to create a rule explained above.

Initially, we won’t have any rules just yet. Click on “New Rule” button.
And fill out the information on the right side as follows.

Then click on “Add Action” button to associate an action to this rule.

Scroll down and select “like” action then click “OK” button. You will see it connected an action node to the rule created earlier. The following screen will show up.

In additional, we can specify URL or Filter String for certain action to be fired only if the input url or filter string matches the one defined in the rule. We skip this process for now. But keep in mind that we can specify one. If there’s no url or filter string specified, then it means the action is global-like. The benefit in setting this field is when we need such action to be associated with specific task or flow inside user’s application ie. Like while user’s during the certain screen, like when certain situation happens. Thus we might specify such url or filter string as “like-social-screen”, or “like-event-A”.

Click on “Add : condition & reward”, and click on “Condition”.

Select “counter” condition, then click “OK” button. It will show a screen for us to fill out information about such condition. Enter the information as follows.

Count : 2
Timeout : 20 Second
Reset Timeout : true

The above means that we will count such action if performed for 2 times, and each within 20 seconds delay. If such action is triggered, then the timeout will be reset. Thus this is perfectly what we want!

Next click on “Add : condition & reward” button again, this time click on “Reward”.

Select badge, then click “OK” button.

Then click on modify button on “ITEM ID” section. The tiny reward button next to the empty image will show. Click on it, then the following screen will be shown.

It will show the available badge that we’ve created earlier. Tick on it, and click “Insert” button. It will associate that badge with the rule.

Click on “Engine” on the left panel. You will see that we have our rule defined in our app now. Make sure to enable the rule if it’s not.

We’re all set for the setup on the Playbasis’s dashboard. Now we will switch to our application development with XCode.

Please continue of this sample project on part 2.