RestKit compile fails with cocoapods use_frameworks for swift

血红的双手。 提交于 2019-12-23 07:19:09

问题


I am using RestKit along with some Swift only frameworks and when I use the cocoapods use_frameworks! flag, I get compile errors. It can't find CoreData.h in the bridging header and can't find RKValueTransformers.h

If I remove the flag it all compiles correctly.

Anyone else seen this? Is there a workaround


回答1:


As far as I know one can only use either Objective-C or Swift libraries in the bridging-header. There is no solution enabling you to use both Objective-C and Swift libraries in the bridging-header. I would say, use the bridging-header for the Objective-C libraries and import Swift libraries manually into the project.




回答2:


I've had a long struggle with this, too, while I was building a private Swift-Framework-Pod that depends on RestKit. After a long fight, I forked RestKit and hacked a workaround.

The drawbacks are, you have to use Cocoapods 0.39, which is pretty legacy and the hacked version of RestKit is forked of 0.25.0, so it's also not the newest of the new.

To use the fork, in your Podfile, replace
pod 'RestKit', ... with
pod 'RestKit', :git => 'https://github.com/resmio/RestKit', :tag => 'v0.25.0-use-frameworks'

Also, you might need to use a hacked version of AFNetworking, which also made some problems.
Same here, replace
pod 'AFNetworking', ... with
pod 'AFNetworking', :git => 'https://github.com/resmio/AFNetworking', :tag => 'v1.3.4-use-frameworks'

I'd be glad if you'd let me know if that wrked for you and if so, spread the word! :)




回答3:


Finally RestKit's latest versions worked. However, I have since switched to SYNC and AlamoFire for all my syncing needs. YMMV



来源:https://stackoverflow.com/questions/28933956/restkit-compile-fails-with-cocoapods-use-frameworks-for-swift

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