Search code examples
iosswiftteamviewer

Cannot convert value of type '(TVSessionConfigurationBuilder!) -> Void' to expected argument type 'TVSessionConfigurationBuilderBlock!'


Just followed the iOS TeamViewer SDK tutorial but it won't work for me using Swift.

let sessionConfiguration : TVSessionConfiguration = TVSessionConfiguration.tvSessionConfigurationWithBlock(
{
    (builder: TVSessionConfigurationBuilder!) -> Void in
    builder.sessionCode = "SESSION_CODE"
})

Gives the error in the title.

Any suggestions?


Solution

  • Try this instead:

    let sessionConfiguration = TVSessionConfiguration(block: { builder in
        builder?.sessionCode = "SESSION_CODE"            
    })