registering the developer account
Please go to the official cloud website to register the developer account. When registering, you need to provide the real mailbox and the mobile number, so that we can send you important notice and in the emergency time to contact you. If you do not provide the correct mailbox and mobile number, we may close your application at any time. Download SDK
You can go to the Rong Yun official website to download the cloud SDK.
The SDK download package is divided into the following two parts: Cloud IM interface Components-rong Cloud imkit (including imlib) cloud IM communication capability Library-Rong Cloud imlib
OK, the download should already have started and you can continue reading down during the download process.
First, let's start by creating your first application. Note: Because of the specificity of the IOS development compiler principle, the. A file in the downloaded SDK package has a larger size, but does not mean that the final IPA file size will be increased accordingly. The actual end will increase your App size around 2MB. Create an application
Before you can apply for development, you need to create applications on the cloud developer platform first. If you have already registered the Cloud developer account, please go to the Cloud developer platform to create the application, if you have not registered the Cloud developer account, please go to Cloud official website to register the developer account first, and then create the application after registering.
After you've created your application, the most important thing to know is the app Key/secret, which is the identity of the cloud SDK connection server, and each app corresponds to a suite of app Key/secret. For the developer's production environment and development environment, we provide two sets of App Key/secret, you use the development environment before the final application, the two sets of environment functions exactly the same. App Key/secret location development environment App Key/secret is for development only, the development environment will be isolated from the production environment data and the data of the development environment and the online production environment. Under the development Environment category, you can find the development App Key/secret. You can always use the development environment APP Key/secret before you apply for online.
Production environment of the app Key/secret default first, and so you submit the online, we will provide the production environment of the app Key/secret. developing and preparing the following documentation will introduce you to the Imkit interface component development approach. If you want to know how to use imlib, we provide the API documentation.
Our SDK minimum support to IOS 6.0, please note when building your project. As Apple's official support changes, we will soon turn to support for IOS 7.0 and 8.0,6.0 compatibility We are no longer active maintenance, but if you find compatibility issues, you can send a work order to contact us to fix it. 1, create the project
When creating a demo project, choose to create a Empty application to facilitate the demo. Create Empty Application 2.1, install SDK via Cocoapods
Cocoapods is a popular Cocoa Project dependency management tool, we recommend that you use Cocoapods first to install the SDK, which can greatly simplify the installation process. The following are the steps:
Create a Podfile file in your project root and add the following to refer to the Imkit Interface component library:
Pod ' Rongcloudimkit '
If you need to refer to the Imlib Communication capability Library, you can add:
Pod ' Rongcloudimlib '
Do not reference Imkit and imlib at the same time, because Imlib is already included in the Imkit. Duplicate references can cause referential conflicts and cannot be compiled correctly.
Then, execute the command pod install install the Cloud SDK. Note: When you open the project later, you need to use the Cocoapods build. Xcworkspace open, not before. Xcodeproj.
You can learn how to use Cocoapods by referring to the Cocoapods installation and use Tutorials article.
Here's a special thank you for Zhuohui Yu for helping to create and maintain a cloud-melting cocoapods project. 2.2, the manual installation melts the cloud SDK Referencing Files
The Rong_cloud_ios_sdk_vx_x_x.zip package downloaded by the Generals network is extracted to any directory. Open the Imkit directory and add the Headers directory header file, ios_imkit.a file, and Rongcloud.bundle file to the project. Do not reference Imkit and imlib at the same time, because Imlib is already included in the Imkit. Duplicate references can cause referential conflicts and cannot be compiled correctly. Adding dependent libraries
The libraries that need to be relied on in engineering are the following (depending on the functionality used, some libraries are not required in all cases): Audiotoolbox.framework avfoundation.framework cfnetwork.framework Coreaudio.framework coregraphics.framework coreimage.framework corelocation.framework CoreMedia.framework Coretelephony.framework corevideo.framework foundation.framework libc++.dylib libsqlite3.dylib libstdc++.dylib Libz.dylib mapkit.framework opengles.framework quartzcore.framework systemconfiguration.framework UIKit.framework Writing code 1. Initialize SDK
Use the APP key that you previously registered from the Cloud developer platform and pass in the Initwithappkey:devicetoken: method to initialize the SDK. Devicetoken is the unique identification of the device used for the Apple Push Notification Service, see Apple's official local and push Notification programming Guide
For the entire application global, you only need to invoke the Initwithappkey:devicetoken: method. Here, we choose to invoke the Initwithappkey:devicetoken: method when the APP initializes. When the PUSH notification permission is obtained, the Setdevicetoken method is used to set the Devicetoken. Initwithappkey:devicetoken: The Devicetoken parameter in the method has been discarded and is currently passed in nil, which will be removed from subsequent versions.
APPDELEGATE.M files are as follows:
#import "AppDelegate.h"//reference Imkit header file.
#import "RCIM.h"//reference Viewcontroller header file. #import "ViewController.h" @interface appdelegate () @end @implementation appdelegate-(BOOL) application: (Uiapplicati On *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {Self.window = [[UIWindow alloc] InitWit
Hframe:[[uiscreen Mainscreen] bounds]];
Override point for customization after application launch.
Initialize the SDK, the incoming App Key,devicetoken is temporarily empty, waiting to get permissions.
[Rcim initwithappkey:@ "E7X8XYCSX6FLQ" devicetoken:nil];
#ifdef __IPHONE_8_0//Registered Apple push under IOS 8, request push permission.
Uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes: (UIUserNotificationTypeBadge | Uiusernotificationtypesound |
Uiusernotificationtypealert) Categories:nil]; [[UIApplication Sharedapplication] registerusernotificationsettings:settings];
#else//Register Apple Push, apply for push permission. [[uiapplication sharedapplication] registerforremotenotificationtypes:uiremotenotificationtypebadge | Uiremotenotificationtypealert |
Uiremotenotificationtypesound];
#endif//initialization of Viewcontroller.
Viewcontroller *viewcontroller = [[Viewcontroller alloc]initwithnibname:nil Bundle:nil];
Initialize Uinavigationcontroller.
Uinavigationcontroller *nav = [[Uinavigationcontroller Alloc]initwithrootviewcontroller:viewcontroller];
Sets the background color to black.
[Nav.navigationbar Setbackgroundcolor:[uicolor Blackcolor]];
Initialize Rootviewcontroller.
Self.window.rootViewController = nav;
Self.window.backgroundColor = [Uicolor Whitecolor];
[Self.window makekeyandvisible];
return YES; } #ifdef __iphone_8_0-(void) Application: (UIApplication *) application didregisterusernotificationsettings: (
Uiusernotificationsettings *) notificationsettings {//Register to receive notifications. [APplication Registerforremotenotifications]; }-(void) Application: (UIApplication *) application Handleactionwithidentifier: (NSString *) identifier Forremotenotification: (nsdictionary *) userInfo Completionhandler: (void (^) ()) Completionhandler {//Handle the actions
.
if ([identifier isequaltostring:@ "Declineaction"]) {} else if ([identifier isequaltostring:@ "Answeraction"]) {
#endif//Get Apple push permission succeeded. -(void) Application: (UIApplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *)
Devicetoken {//Set Devicetoken.
[[Rcim Sharedrcim] setdevicetoken:devicetoken]; }-(void) Application: (UIApplication *) application Didfailtoregisterforremotenotificationswitherror: (NSError *) Error {}-(void) Applicationwillresignactive: (uiapplication *) application {//Sent when the application is about T o move from active to inactive state. This can occur for certain types of temporary interruptions (such as a incoming phone call or SMS message) orWhen the user quits the "application" and it begins the transition to the background state. Use the To pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates.
Games should to pause the game. }-(void) Applicationdidenterbackground: (uiapplication *) Application { , save user data, invalidate timers, and store enough application state information to restore your application to its cur
Rent state in case it is terminated later. If your application supports background execution, this is called instead of Applicationwillterminate:when the
User quits. }-(void) Applicationwillenterforeground: (uiapplication *) application {//called as part of the transition from the Background to the inactive state;
Here you can undo many of the changes made on entering the background. }-(void) Applicationdidbecomeactive: (uiapplication *) application {//restart any tasks, that were PAUsed (or not yet started) while the application is inactive.
If the application is previously in the background, optionally refresh the user interface. }-(void) Applicationwillterminate: (uiapplication *) application {//called when the application was about to Terminat E. Save data if appropriate.
Also applicationdidenterbackground:.
} @end
The app key value E7X8XYCSX6FLQ in the above code is just an example, and direct copy execution will return an error, please be careful to replace it with your own app key value. The above example method is not the only solution, you can choose the right time to initialize the SDK.
2. Get Token
Token also called the user token, is the SDK to connect the cloud server credentials, each user connected to the server needs a Token. Each time you initialize a connection server (see the next section), you will need to submit Token to the server.
To get user Token, the process is as follows: First you need your app to query your application server, then your application server accesses the cloud server, and finally returns to App,app to log in with the returned Token connection server. Please refer to the Identity Authentication Service section in the Server Development Guide for detailed description. To facilitate your testing development, we also provide API debugging tools so that you can directly obtain the user tokens required for test development without deploying server-side programs. Please visit our Cloud Developer platform, open the application you want to test, and choose API Debug from the menu on the left.