Follow the instructions below to ensure that QuickBlox iOS SDK runs smoothly with your app.
Minimum system requirements
- iOS 9
- CocoaPods 1.1
- Xcode 11
QuickBlox application includes everything that brings messaging right into your application - chat, video calling, users, push notifications, etc. To create a QuickBlox application, follow the steps below:
- Register a new account following this link. Type in your email and password to sign in. You can also sign in with your Google or Github accounts.
- Create the app clicking New app button.
- Configure the app. Type in the information about your organization into corresponding fields and click Add button.
- Go to Dashboard => YOUR_APP_ID => Overview section and copy your Application ID, Authorization Key, Authorization Secret, and Account Key .
CocoaPods must be installed.
- Create a
Podfile. Project dependencies should be managed by CocoaPods. Create this file in the same directory with your project.
pod init touch Podfile open -e Podfile
- Open the created
Podfileand enter the following code lines into it.
platform :ios, "11.2" use_frameworks! target 'MyApp' do pod 'QuickBlox', '~> 2.17.4' pod 'Quickblox-WebRTC', '~> 2.7.4' end
- Install QuickBlox dependencies in your project.
- Import headers to start using QuickBlox frameworks.
Initialize your app on QuickBlox server by passing
accountKey via AppDelegate file located in the root directory of your project.
QBSettings.applicationID = 92 QBSettings.authKey = "wJHdOcQSxXQGWx5" QBSettings.authSecret = "BTFsj7Rtt27DAmT" QBSettings.accountKey = "7yvNe17TnjNUqDoPwfqp" QBSettings.apiEndpoint = "https://yourApi.quickblox.com" QBSettings.chatEndpoint = "yourChat.quickblox.com"
[QBSettings setApplicationID:92]; [QBSettings setAuthKey:@"wJHdOcQSxXQGWx5"]; [QBSettings setAuthSecret:@"BTFsj7Rtt27DAmT"]; [QBSettings setAccountKey:@"7yvNe17TnjNUqDoPwfqp"]; [QBSettings setapiEndpoint:@"https://yourApi.quickblox.com"]; [QBSettings setchatEndpoint:@"yourChat.quickblox.com"];
Required to get actual Chat and API endpoints for the right server.
For Basic, Startup, and Growth plan users
- Make sure you set
accountKeyto get all correct endpoints.
- Make sure to leave
chatEndpointfields empty to provide a smooth migration between servers.
For Enterprise plan users
Contact our sales team to get API and Chat endpoint.
Configure API and Chat endpoints after initialization. If you have your own API and Chat servers you should set these endpoints manually using the code snippet below.
You can use our SDK in the background mode as well. If you want to receive push notifications when the app goes to background mode, this requires you to add specific app permissions. Under the app build settings, open the Capabilities tab and turn on Remote notifications checkbox only.
If you want to use video calling functionality in the background mode, set the Audio, AirPlay, and Picture in Picture checkboxes.
QuickBlox Chat runs over XMPP protocol. To receive messages in a real-time mode, the application should be connected to the Chat over XMPP protocol. To enable autoreconnection to Chat, call the
autoReconnectEnabled() method and pass enable as
By default, autoreconnection functionality is disabled.
Make sure to enable autoreconnection before calling the
Message carbons functionality allows for multi-device support. Thus, all user messages get copied to all their devices so they could keep up with the current state of the conversation. For example, a User A has phone running conversations and desktop running conversations. User B has desktop running conversations. When User B sends a message to User A, the message shows on both the desktop and phone of User A.
Enable message carbons
Disable message carbons
Since message carbons functionality works over XMPP connection, make sure to enable it after the
logIn() method is called.
Stream management has two important features Stanza Acknowledgements and Stream Resumption:
- Stanza Acknowledgements is the ability to know if a stanza or series of stanzas has been received by one's peer. In other words, a reply is requested on every sent message. If the reply is received, the message is considered as delivered.
- Stream Resumption is the ability to quickly resume a stream that has been terminated. So once a connection is re-established, Stream Resumption is executed. By matching the sequence numbers assigned to each Stanza Acknowledgement a server and client can verify which messages are missing and request to resend missing messages.
Set message timeout to enable stream resumption. The preferred resumption time should be set in seconds. If this parameter is greater than
0, then it is applied, otherwise, it is not applied.
QBSettings.streamManagementSendMessageTimeout = 0
[QBSettings setStreamManagementSendMessageTimeout: 0];
Stream management gets enabled automatically once the
connect() method is called and disabled once the
disconnect() method is called.
Updated 28 days ago