swift - Cannot access Swift Framework in Objective-C
问题描述
Create Swift Framework ,
Geolens.swift
When i am trying to access in Objective-C project , cannot call 2 methods
createuser
& startSessionForUser
Getting error like this
Method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C
解决方案
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:
- get rid of optionality
- use reference type, such as
NSNumber
or your own wrapper - drop this parameter completely
推荐阅读
- mysql - 无法在 FK 列中插入 NULL 值
- python - _imagingft c 模块未安装 amazon linux elasticbeanstalk
- javascript - 使用 JavaScript 在 Selenium 中执行 JavaScript 代码
- swift - Xcode 13.0 中的模棱两可的布局警告
- php - 如何在 laravel 中显示旧的 datetime-local 值?
- sql - 在主表中生成虚拟列
- mysql - 如何为重新测试记录创建模式?
- python - 在 PyTorch 中计算加权平均值
- c++ - OpenCV C++ 中的位移
- javascript - Mongoose Model.Create 和 Model.Update 另一个