iOS development-5 minutes of integrated cloud-enabled customer service

Source: Internet
Author: User

Recent projects encountered the function of customer service, the first thought is the use of cloud features, because the previous instant messaging projects, with the integration of the Cloud SDK, took a little time to study the next, hope to help everyone!

Don't say much nonsense, the steps are as follows:

First, apply for cloud account

Second, create the application

Third, the opening of customer service, melting cloud of customer service integration is wisdom tooth customer services system, fully able to meet the use!

Four, after the opening of customer service services, will generate customer service Id,target ID is this, to enter the chat page before using

Five, into the application management interface, click API debugging, ID and username, as well as the Avatar URL can be randomly lost, testing, the following will be printed, generate a token

Six, the preparation work done, the following code:

-(Ibaction) Gochatclick: (ID) Sender {Chatviewcontroller*chatservice =[[Chatviewcontroller alloc] init];#defineservice_id @ "KEFU149269681191160"Chatservice.namestr=@"Customer Service"; Chatservice.conversationtype=Conversationtype_customerservice; Chatservice.targetid=service_id; Chatservice.title=Chatservice.namestr;        [Self.navigationcontroller Pushviewcontroller:chatservice Animated:yes]; }-(Ibaction) Creatrongcloudclick: (ID) Sender {//register a cloud server[[Rcim Sharedrcim] initwithappkey:rongkey]; [[Rcim Sharedrcim] connectwithtoken:rongtoekn success:^ (NSString *userId) {NSLog (@"landed successfully. Currently logged in user id:%@", userId); } Error:^(Rcconnecterrorcode status) {NSLog (@"The login error code is:%ld", (Long) status); } tokenincorrect:^{        //token expires or is not correct. //If token expiration is set and token expires, please re-request your server for a new token//If the token expiration is not set and the token error is indicated, check to see if your client and server Appkey match and check your token acquisition process. NSLog (@"Token error"); }];}

Print as follows:

Chat that class directly inherit Rcconversationviewcontroller can, enter the page will be happy to chat!

At this point, the customer service function is complete!

iOS development-5 minutes of integrated cloud-enabled customer service

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.