简体   繁体   中英

Cannot Invoke an Argument List type

I am trying to configure the iOS SDK from Zopim into my code. My iOS code is written in Swift and I've imported the framework of the SDK which is written in Obj C. I have created a bridging header and was able to import from the framework.

In order to be able to configure and connect with Zopim I need to include the following code in my Appdelegate.swift file.

Object C Code:

[ZDCChat configure:^(ZDCConfig *defaults) { defaults.accountKey = @"you account key here"; }];

I have tried to convert the above code into Swift (code below) however I'm getting the following error - Cannot Invoke Configure with an argument list of type ZDCConfig

Swift code:

ZDCChat.configure({(defaults: ZDCConfig) in defaults.accountKey = "you account key here"})

The ZDCConfig code include the following:

@interface ZDCConfig : ZDCSessionConfig

/** * The Zopim account key (must be set before a chat can be started). */

The ZDCChat code include the following:

** * The core of the Chat SDK, all objects related to chat can be accessed * from here either directly or indirectly. */ @interface ZDCChat : NSObject

/** * The chat session. */

Can anyone guide me as to what is causing the problem ?

I had to add a bridging header that contained these two lines-

#import <ZDCChat/ZDCChat.h>
#import <MobileCoreServices/MobileCoreServices.h>

and then I was able to make that call like this-

    ZDCChat.configure {
        defaults in
            defaults.accountKey = ""
    }

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM