0

Create Swift Framework ,

Geolens.swift

enter image description here

When i am trying to access in Objective-C project , cannot call 2 methods

createuser & startSessionForUser

enter image description here

Getting error like this

Method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C

Getting error adding @objc

4

3 回答 3

1

Your problem is in errorCode: Int? in UserCompletionBlock.

Int is value type, and Objective C cannot represent Optional of value type, only reference types such as class will.

So you have to either:

  1. get rid of optionality
  2. use reference type, such as NSNumber or your own wrapper
  3. drop this parameter completely
于 2018-06-07T09:14:15.123 回答
0

Add @objc:

@objc public func createUser(...) { ... }
@objc public func startSessionForUser(...) { ... }
于 2018-06-07T08:34:52.657 回答
0

If you want the methods to be accessible in Obj-C also please make sure you add @objc public in definition of all the methods. Just the way you did it in didRegister... and didFailedToRegisrer... methods in your class.

Happy Coding...

于 2018-06-07T08:49:46.957 回答