iOS development--Instant Messaging

Source: Internet
Author: User

What is a ring letter?

1. Ring Letter is a third platform providing instant messaging (im–instant Messaging) Services

2. The ring is a two-time development based on XMPP

3. The data that the ring transmits on the network is also XML

4. Use the ring letter, do not have to build a server, cost savings

5. Ring Letter Day Live below 300,000, forever free

Why choose a ring letter?

Data source Eric: Click to jump

Data source easy to view: Click to jump



Preparation of integrated ring letter Prerequisites:

1. Register as a link developer Click to enter the ring letter


2. Create an app in the developer background to get key


3. Download the official SDK DEMO click to view



Integration SDK Steps:

1. Importing the SDK


2. Set project Properties


2.2 SDK Dependency Library has


Note: ( If you are using Xcode7, suffix tbd) < tips >


2.3 If there is a conflict with-OBJC in your project, you can add-force_load to resolve



The 2.4 SDK does not support Bitcode, setting No in Build settings→linking→enable Bitcode.

Compiling the project

After the above steps are finished, compile the project, if there is no error, congratulations, the Integration SDK success, you can proceed to the next step.

SDK Synchronous/Async methods differentiate:

In the SDK, most network-related operations provide a synchronous approach (note: The synchronization method blocks the main thread and requires the user to create an asynchronous thread execution; Async is the Async method)

Initializing the SDK

1. Introduce the relevant header file #import "EMSDK.h"

2. In the following method in the appdelegate of the project, call the SDK corresponding method:


The SDK interface parameters that are called are interpreted as follows:

1.AppKey: Differentiate app logo, developer registration and admin background

2.apnscertname:ios the name of the certificate in the push. Create and upload a push certificate

3. Ring Letter for the IM section provides APNS push function, if you want to use, please jump to APNs offline push

Registered:

1. The registration mode is divided into two types, open registration and authorized registration. Client registration is only possible if the registration is open.

2. Open registration is for testing purposes, the formal environment is not recommended to register a ring letter account, the authorization process should be your server through the rest API provided by the ring to register, and then save to your server or return to the client.


Landing:

Login: Invokes the operation of the SDK's login interface;


Automatic Login:

Automatic login: After the first login is successful, you do not need to call the login method again, and the SDK will log you in automatically the next time the app launches. And if you fail to log on automatically, you can also read the previous session information. Configure whether to log in automatically the automatic login property is turned off by default and requires that you set it after the login succeeds so that you do not need to call the ring login again the next time the app starts, and can get a list of sessions without a network.


Automatic login will be canceled in the following cases

1. The user invokes the SDK logout action;

2. The user changed the password on another device, causing the automatic login to fail on this device;

3. The user's account is deleted from the server side;

4. The user logs on from another device and kicks the user who is logged on to the current device.

Therefore, before you call the login method, you should first decide whether to set up automatic login, if set, you do not need to call


In the SDK, if an automatic login occurs, the following callback


reconnects

When the line is dropped, the IOS SDK will automatically re-connect and only need to listen for the re-connected callback, without any action.


Exit Login:

There are two types of exit logins: Active logout and passive sign-out.

Active Exit Login: Call the SDK exit interface;

Passive Exit Login: 1, the account is logged on another device to log on, 2, the login account is deleted from the server side.

Logout:yes: Whether to release device token binding, the SDK internal processing when the passive exit, do not need to call the Exit method


Passive Logout Login:

Callback Method Listener:


There are many more features, and the official website is very very clear!

Friend Management

Note: Ring letter is not a friend can also chat, do not recommend the use of ring letter friend mechanism. If you have your own server or friend relationship, please maintain your friend relationship.

Get Friends List

To get a list of friends, the ring letter provides two methods.

1. Get all your friends from the server


2. Get all your friends from the database


Friend application
Send a Friend request

The ring-letter iOS SDK provides a way to add friends

If you have already sent and the other party does not process, you will not be able to send again


Real-time Call management client

1. Initiate a live call


2. The called party agrees to call in real time


3. End Live Call


4. Real-time Call instances


And so on ... Click to view Details

Easeui User Guide

Easeui is a UI library that encapsulates the commonly used controls for IM functionality, fragment, and so on, designed to help developers quickly integrate the Sdkeaseui and demo GitHub:

Https://github.com/easemob/easeui;

https://github.com/easemob/sdkdemoapp3.0_android,3.0 code needs to switch to sdk3.0 branch

Note: because this is a UI library, subsequent changes are likely to continue, and the old and new versions will not be as completely compatible with the API as the IM SDK. (official website is prompted)

Code Import

Easeui Library code is open source, the download of the SDK package contains this library, the decompression path is/examples/easeui

Import in Eclipse:

1. First import the Easeui project into eclipse

2. Introduce Easeui as a library in its own project. Right click on the Add button in the bottom right corner of your project →android→ → Select Easeui→ok→ok

Import in Android Studio: Open your as Project →file→new→import module→ Select or enter the Easeui library path →next→next→finish

You may have the following errors when you finish importing:


Find the appropriate error place to change the swiperefreshlayout.setcolorschemeresources to Swiperefreshlayout.setcolorscheme,viewcompat.getx to new Viewcompat (). GetX, then build again, or increase the version number of the V4 package, such as compile ' com.android.support:support-v4:23.1.1 '.

Main fragment

1.EaseConversationList-Chat page, the main fragment

2.EaseContactListFragment-Contact Page

3.EaseConversationListFragment-session List page


Main control

1.EaseTitleBar-title bar

2.EaseChatMessageList-Chat Message list control

3.EaseConversationList-session List control

4.EaseContactList-Contact List page

5.EaseChatInputMenu-Chat Input menu bar

Other child controls, which are described in more detail later in this article

Here is a simple illustration of several controls on the chat page:


Similar to these features:


Here are introduced, but feel such a good thing on the official website no one to see, too bad ... Click to view Details

Introduction to the General API changes:

All is the official website the thing, with June Mutual encouragement!



Wen/Baidu engineer Ah Wei (Jane book author)
Original link: http://www.jianshu.com/p/73be68baa1ac
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".

iOS development--Instant Messaging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.