Code Monkey home page Code Monkey logo

quickblox-ios-sdk's Introduction

QuickBlox

QuickBlox - Communication & cloud backend (BaaS) platform which brings superpowers to mobile apps.

QuickBlox is a suite of communication features & data services (APIs, SDKs, code samples, admin panel, tutorials) which help digital agencies, mobile developers and publishers to add great functionality to smartphone applications.

Please read full iOS SDK documentation on the QuickBlox website, iOS section

QuickBlox iOS SDK

This project contains QuickBlox iOS SDK, that includes

How to start

To start work you should just put framework into your project and call desired methods.

Latest framework file you can download from GitHub.

Documentation

Oh, please, please show me the code

iOS SDK is really simple to use. Just in few minutes you can power your mobile app with huge amount of awesome communication features & data services.

1. Get app credentials

2. Create new iOS project

3. Add framework to project, see this tutorial

4. Make QuickBlox API calls

The common way to interact with QuickBlox can be presented with following sequence of actions:

  1. Initialize framework with application credentials
  2. Create session
  3. Login with existing user or register new one
  4. Perform actions with QuickBlox communication services and any data entities (users, locations, files, custom objects, pushes etc.)

4.1 Initialize framework with application credentials

[QBSettings setApplicationID:92];
[QBSettings setAuthorizationKey:@"wJHdOcQSxXQGWx5"];
[QBSettings setAuthorizationSecret:@"BTFsj7Rtt27DAmT"];

4.2. Create session

[QBAuth createSessionWithDelegate:self];

- (void)completedWithResult:(Result *)result{
    if(result.success && [result isKindOfClass:QBAAuthSessionCreationResult.class]){
        // Success, do something
    }
}

4.3. Register/login

First create (register) new user

QBUUser *user = [QBUUser user];
user.login = @"garry";
user.password = @"garry5santos";

[QBUsers signUp:user delegate:self];

- (void)completedWithResult:(Result *)result{
    if(result.success && [result isKindOfClass:QBUUserResult.class]){
        // Success, do something
        QBUUserResult *userResult = (QBUUserResult *)result;
        NSLog(@"New user=%@", userResult.user);
    }
}

then authorize user

[QBUsers logInWithUserLogin:@"garry" password:@"garry5santos"  delegate:self];

- (void)completedWithResult:(Result *)result{
    if(result.success && [result isKindOfClass:QBUUserLogInResult.class]){
        // Success, do something
        QBUUserLogInResult *userResult = (QBUUserLogInResult *)result;
        NSLog(@"Logged In user=%@", userResult.user);
    }
}

to authorise user in Chat

QBUUser *currentUser = [QBUUser user];
currentUser.ID = 2569; // your current user's ID
currentUser.password = @"garrySant88"; // your current user's password   
 
// set Chat delegate
[QBChat instance].delegate = self;
 
// login to Chat
[[QBChat instance] loginWithUser:currentUser];
 
#pragma mark -
#pragma mark QBChatDelegate
 
// Chat delegate
-(void) chatDidLogin{
    // You have successfully signed in to QuickBlox Chat
}

4.4. Perform actions

Send Chat message

// send message
QBChatMessage *message = [QBChatMessage message];
message.recipientID = 546; // opponent's id
message.text = @"Hi mate!";
 
[[QBChat instance] sendMessage:message];
 
 
#pragma mark -
#pragma mark QBChatDelegate
 
- (void)chatDidReceiveMessage:(QBChatMessage *)message{
    NSLog(@"New message: %@", message);
}

Create new location for Indiana Jones

QBLGeoData *location = [QBLGeoData geoData];
location.latitude = 23.2344;
location.longitude = -12.23523;
location.status = @"Hello, world, I'm Indiana Jones, I'm at London right now!";

[QBLocation createGeoData:location delegate:self];

- (void)completedWithResult:(Result *)result{
    if(result.success && [result isKindOfClass:QBLGeoDataResult.class]){
        // Success, do something
        QBLGeoDataResult *locationResult = (QBLGeoDataResult *)result;
        NSLog(@"New location=%@", locationResult.geoData);
    }
}

or put Image into storage

NSData *file = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"YellowStar" ofType:@"png"]];

[QBContent TUploadFile:file fileName:@"Great Image" contentType:@"image/png" isPublic:YES delegate:self];

- (void)completedWithResult:(Result *)result{
    if(result.success && [result isKindOfClass:QBCFileUploadTaskResult.class]){
        // Success, do something
    }
}

-(void)setProgress:(float)progress{
    NSLog(@"progress: %f", progress);
}

iOS Framework provides following classes to interact with QuickBlox API (each class has suite of static methods):

  • QBAuth
  • QBUsers
  • QBChat
  • QBCustomObjects
  • QBLocation
  • QBContent
  • QBRatings
  • QBMessages

See also

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.