首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mesibo chat sdk在ios中的集成

Mesibo chat sdk在ios中的集成
EN

Stack Overflow用户
提问于 2019-05-20 11:17:04
回答 2查看 515关注 0票数 1

我正在设置mesibo chat sdk. auth key generated and set it toAppdelegate.Create`,它是Mesibo仪表板中的一个用户,试图发送或接收消息,但没有收到任何消息。仪表板上显示错误:-

“未能发送消息”。

为此使用mesibo框架a.Implement委托方法。

Appdelegate代码在完成启动。

代码语言:javascript
复制
Mesibo.getInstance()!.setAccessToken("1c06e8813355b567b0f79162d5ff786e96b419122ade88ef68")
Mesibo.getInstance()!.setSecureConnection(true)
Mesibo.getInstance()!.start()

查看控制器代码:-

代码语言:javascript
复制
MesiboUI.launchMessageViewController(self, profile:nil)
Mesibo.getInstance()?.start()

我希望能从一个人到一个人的即时聊天。

EN

回答 2

Stack Overflow用户

发布于 2019-05-20 11:28:48

尝试在didFinishLaunching方法中添加侦听器:

MesiboInstance加法器:self;

票数 0
EN

Stack Overflow用户

发布于 2020-04-08 09:51:31

代码语言:javascript
复制
    **Please check in Appdelegate : 

        mesiboInstance?.setAccessToken("youraccesstoken")

        Mesibo.getInstance()?.addListener(self)
        Mesibo.getInstance()?.start()

    //MARK:- Get user permission for using camera , audio


    extension AppDelegate {

        func checkCameraAccess() {
            switch AVCaptureDevice.authorizationStatus(for: .video) {
                case .denied:
                    print("Denied, request permission from settings line 288")
                //presentCameraSettings()
                case .restricted:
                    print("Restricted, device owner must approve line 291")
                case .authorized:
                    print("Authorized, proceed line 293")
                case .notDetermined:
                    AVCaptureDevice.requestAccess(for: .video) { success in
                        if success {
                            print("Permission granted, proceed line 297")
                        } else {
                            print("Permission denied")
                        }
                }
            }
        }

        func checkMicPermission() {
            switch AVAudioSession.sharedInstance().recordPermission {
                case AVAudioSession.RecordPermission.granted:
                    print("mic Permission granted , line 305")
                    break
                case AVAudioSession.RecordPermission.denied:
                    print("mic Permission not granted , line 309")
                    break
                case AVAudioSession.RecordPermission.undetermined:
                    AVAudioSession.sharedInstance().requestRecordPermission({ (granted) in
                        if granted {
                            print("mic Permission granted , line 312")

                        } else {
                            print("mic Permission denied , line 314")
                        }
                    })
                default:
                    break
            }
        }

    }
    extension AppDelegate {

        func setRootController(_ controller: UIViewController?) {
            window!.rootViewController = controller
            window!.rootViewController = controller
            window!.makeKeyAndVisible()
            //[[UIApplication sharedApplication].keyWindow setRootViewController:rootViewController];
        }
        public func mesibo_(onGetMenu parent: Any!, type: Int32, profile: MesiboUserProfile!) -> [Any]! {

            var btns: [AnyHashable]? = nil

            if type == 0 {
                let button = UIButton(type: .custom)
                button.setImage(UIImage(named: "ic_message_white"), for: .normal)
                button.frame = CGRect(x: 0, y: 0, width: 44, height: 44)
                button.tag = 0

                let button1 = UIButton(type: .custom)
                button1.setImage(UIImage(named: "ic_more_vert_white"), for: .normal)
                button1.frame = CGRect(x: 0, y: 0, width: 44, height: 44)
                button1.tag = 1

                btns = [button, button1]
            } else {
                if profile != nil && profile?.address != nil {
                    let button = UIButton(type: .custom)
                    button.setImage(UIImage(named: "ic_call_white"), for: .normal)
                    button.frame = CGRect(x: 0, y: 0, width: 44, height: 44)
                    button.tag = 0
                    let vbutton = UIButton(type: .custom)
                    vbutton.setImage(UIImage(named: "ic_videocam_white"), for: .normal)
                    vbutton.frame = CGRect(x: 0, y: 0, width: 44, height: 44)
                    vbutton.tag = 1

                    btns = [vbutton, button]
                }
            }

            return btns

        }

        public func mesibo_(onMenuItemSelected parent: Any!, type: Int32, profile: MesiboUserProfile!, item: Int32) -> Bool {

            // userlist menu are active
            if type == 0 {
                // USERLIST
                if item == 1 {
                    //item == 0 is reserved
    //                MesiboUIManager.launchSettings(parent as! UIViewController)
                }
            } else {
                // MESSAGEBOX
                if item == 0 {
                    print("Menu btn from messagebox pressed")
                    MesiboCall.sharedInstance().call(parent, callid: 0, address: profile?.address, video: false, incoming: false)
                } else if item == 1 {
                    DispatchQueue.main.async(execute: {


                        MesiboCall.sharedInstance().call(parent, callid: 0, address: profile?.address, video: true, incoming: false)

                    })
                }
            }
            return true
        }
    }

In your view controller


    import UIKit


class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        //Set user here

        let profile : MesiboUserProfile = MesiboUserProfile()
        profile.address = "youremail@email.com"
        MesiboUI.launchMessageViewController(self, profile: profile)

    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56219891

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档