iOS Ring Telecom 3.1. Implementation of Integration and Function

  • SDK integration

1. Preparations:

· Let's assume that you've applied for the developer's account of Entertainment.
· This assumes that you have configured the certificate in the Apple Developer Center and uploaded it to Ring.
· If you don't need the push function of offline messages, you don't need to configure certificates.
· Download the latest SDK from the official website of CITIC and decompress it to a easy-to-find place.

2. Copy the Hyphenate Full SDK folder in the ios_IM_sdk_V3.1.5 folder to your project directory folder.

Paste_Image.png

3. Open the Xcode, press the shortcut key: Alt+Command+A, and add the Hyphenate Full SDK to the project directory.
Paste_Image.png

4. Comment a part of the code in EMSDK.h in include under the Hyphenate Full SDK directory:
Paste_Image.png

5. Comment a part of the code in EMSDKFull.h in include under the HyphenateFull SDK directory:
Paste_Image.png

6. Point Build Phases Link Binary With Libraries, add dependency Libraries

SDK includes real-time voice dependency libraries:
CoreMedia.framework
AudioToolbox.framework
AVFoundation.framework
MobileCoreServices.framework
ImageIO.framework
libc++.dylib
libz.dylib
libstdc++.6.0.9.dylib
libsqlite3.dylib
libiconv.dylib
 ** (If xcode7 is used, the suffix is tbd.) * *

Paste_Image.png

7. Copy the EaseUI folder in the ios_IM_sdk_V3.1.5 folder to your project directory folder.
Paste_Image.png

8. Open Xcode, press the shortcut key: Alt+Command+A, and add EaseUI to the project directory.
Paste_Image.png

9. In the beginning and end of your XXX.pch header file, add two lines of code:
Paste_Image.png

//Also, note that these two system libraries must be introduced. Otherwise, it will make a mistake.
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

The mistake is as follows:

Paste_Image.png

10. Possible Error needs to be addressed:

There is MJRefresh in the circular letter. If MJRefresh is also introduced in your project, please delete either of them from your project or from the EaseUI of the circular letter.
Of course, the premise is to make sure that your MJRefresh is up to date
There are SDWebImage libraries in the circular letter, so if you use SDWebImage libraries, please delete the SDWebImage you introduced.
Of course, you can choose not to delete. But there's a little bit of simplicity to do.
Simply delete the previous reference in XXX.pch #import "UIImage+WebCache" and replace it with the reference #import "UIImage+EMWebCache"

11. The end of integration, explanatory part:

After the above series of modifications and add libraries. At this point, you need to test it.
Press the shortcut key: Command+B, and the compilation should pass without error.
  • Function realization
Including: location sending, voice sending, picture sending, photo sending, voice communication, video communication

1. Introduce ChatViewController.h and ChatViewController.m into the official Demo of EIS.
Comment out the following code section of ChatViewController.m to solve Error:
Simply put, just comment out the code of the red warning line.

//#import "ChatGroupDetailViewController.h"
//#import "ChatroomDetailViewController.h"
//#import "UserProfileViewController.h"
//#import "UserProfileManager.h"
//#import "ContactListSelectViewController.h"
//#import "ChatDemoHelper.h"
//#import "EMChooseViewController.h"
//#import "ContactSelectionViewController.h"
//if (ext && ext[kHaveUnreadAtMessage] != nil)
//  {
//   NSMutableDictionary *newExt = [ext mutableCopy];
//   [newExt removeObjectForKey:kHaveUnreadAtMessage];
//   self.conversation.ext = newExt;
//   }
//UserProfileViewController *userprofile = [[UserProfileViewController alloc] initWithUsername:messageModel.message.from];
//[self.navigationController pushViewController:userprofile animated:YES];
//ContactSelectionViewController *selectController = [[ContactSelectionViewController alloc] initWithContacts:members];
//selectController.mulChoice = NO;
//selectController.delegate = self;
//[self.navigationController pushViewController:selectController animated:YES];
//ContactSelectionViewController *selectController = [[ContactSelectionViewController alloc] initWithContacts:members];
//selectController.mulChoice = NO;
//selectController.delegate = self;
//[self.navigationController pushViewController:selectController animated:YES];
//UserProfileEntity *profileEntity = [[UserProfileManager sharedInstance] getUserProfileByUsername:model.nickname];
//if (profileEntity) {
//    model.avatarURLPath = profileEntity.imageUrl;
//    model.nickname = profileEntity.nickname;
//}
//    [[ChatDemoHelper shareHelper] setChatVC:nil];
//        ChatGroupDetailViewController *detailController = [[ChatGroupDetailViewController alloc] initWithGroupId:self.conversation.conversationId];
//        [self.navigationController pushViewController:detailController animated:YES];
//        ChatroomDetailViewController *detailController = [[ChatroomDetailViewController alloc] initWithChatroomId:self.conversation.conversationId];
//        [self.navigationController pushViewController:detailController animated:YES];
//        id<IMessageModel> model = [self.dataArray objectAtIndex:self.menuIndexPath.row];
//        ContactListSelectViewController *listViewController = [[ContactListSelectViewController alloc] initWithNibName:nil bundle:nil];
//        listViewController.messageModel = model;
//        [listViewController tableViewDidTriggerHeaderRefresh];
//        [self.navigationController pushViewController:listViewController animated:YES];
//- (BOOL)viewController:(EMChooseViewController *)viewController didFinishSelectedSources:(NSArray *)selectedSources
//{
//    if ([selectedSources count]) {
//        EaseAtTarget *target = [[EaseAtTarget alloc] init];
//        target.userId = selectedSources.firstObject;
//        UserProfileEntity *profileEntity = [[UserProfileManager sharedInstance] getUserProfileByUsername:target.userId];
//        if (profileEntity) {
//            target.nickname = profileEntity.nickname == nil ? profileEntity.username : profileEntity.nickname;
//        }
//        if (_selectedCallback) {
//            _selectedCallback(target);
//        }
//    }
//    else {
//        if (_selectedCallback) {
//            _selectedCallback(nil);
//        }
//    }
//    return YES;
//}
//- (void)viewControllerDidSelectBack:(EMChooseViewController *)viewController
//{
//    if (_selectedCallback) {
//        _selectedCallback(nil);
//    }
//}

2. Introduce into the official Demo of EIS:
ChatDemoHelper.h,ChatDemoHelper.m, CallViewController.h,CallViewController.m
Delete ChatDemoHelper.m
Be situated between

-(void) initHelper {
#ifdef REDPACKET_AVALABLE
    [[RedPacketUserConfig sharedConfig] beginObserveMessage];
#endif
    [[EMClient sharedClient] addDelegate:self delegateQueue:nil];
    [[EMClient sharedClient].groupManager addDelegate:self delegateQueue:nil];
    [[EMClient sharedClient].contactManager addDelegate:self delegateQueue:nil];
    [[EMClient sharedClient].roomManager addDelegate:self delegateQueue:nil];
    [[EMClient sharedClient].chatManager addDelegate:self delegateQueue:nil];
#if DEMO_CALL == 1
    [[EMClient sharedClient].callManager addDelegate:self delegateQueue:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(makeCall:) name:KNOTIFICATION_CALL object:nil];
#endif
}

and

#pragma mark - EMCallManagerDelegate

All the code between.

Of course, there will still be mistakes.

The following code should also be deleted:

-(void)_clearHelper {
    self.mainVC = nil;
    self.conversationListVC = nil;
    self.chatVC = nil;
    self.contactViewVC = nil;
    [[EMClient sharedClient] logout:NO];
#if DEMO_CALL == 1
    [self hangupCallWithReason:EMCallEndReasonFailed];
#endif
}

Of course, you can't pop up the call interface by clicking the audio and video button like this.
So, you need to add such a line of code to your XXX.pch header file.

#define DEMO_CALL 1

Paste_Image.png

If you want to pop up the call interface and set up the root controller, it must be like this.
That is to say, in ChatDemoHelper.h, you must declare the controller of your chat interface, and the best name is mainVC. This will be easier.
Paste_Image.png

In AppDelegate.m, add the following sentence:

//tabBarCtr is a visual controller for your chat interface. It could be Tabbar or something.
[ChatDemoHelper shareHelper].mainVC = tabBarCtr;
CECNavigationViewController *callNav = nil;  
CECChatRootController *tabBarCtr = [[CECChatRootController alloc] init];
[ChatDemoHelper shareHelper].mainVC = tabBarCtr;
callNav = [[CECNavigationViewController alloc] initWithRootViewController:tabBarCtr]; 
callNav.navigationBarHidden = YES;
self.window.rootViewController = callNav;

Tags: iOS SDK xcode libiconv

Posted on Sun, 03 Feb 2019 00:21:15 -0800 by timelf123