Only factor methods can have swift_name attribute Mapbox

a 夏天 提交于 2019-12-12 01:44:20

问题


I'm using cocoa pods and map box was working fine but I installed an update and this message appeared:

Now I can't run my project. I'm using map box iOS sdk 3.3.4. What should I do to fix this issue?


回答1:


According to apple documentation:

The Swift compiler automatically imports Objective-C code as conventional Swift code. There may be edge cases in your code that are not automatically handled. If you need to change the name imported by Swift of an Objective-C method, enumeration case, or option set value, you can use the NS_SWIFT_NAME macro to customize how a declaration is imported. See more.

So all what I did was delete the implementation of the NS_SWIFT_NAME and with that I was able to build the project. I don't know what made this error appear but this was the best solution I found.

Example: From this:

- (instancetype)recordWithRPM:(NSUInteger)RPM NS_SWIFT_NAME(init(RPM:));

To this:

- (instancetype)recordWithRPM:(NSUInteger)RPM;


来源:https://stackoverflow.com/questions/38966740/only-factor-methods-can-have-swift-name-attribute-mapbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!