Fail to Import RestKit with Cocoapods Dynamic Frameworks

拟墨画扇 提交于 2019-12-30 08:09:18

问题


I have the prelease version of cocoapods installed, 0.26, and trying to install the latest version of RestKit. In my podfile I've turned on the use_frameworks! flag to force cocoapods to use dynamic frameworks.

Putting import RestKit in my swift file causes a build failure: 'RKValueTransformers.h' file not found. RestKit is set up to use a handful of other libraries and include their headers into the project (AFNetworking, RKValueTransformers, TransitionKit, etc.)

According to an article for cocoapod authors I believe the issue is that the way to import and include these libraries need to change to work with dynamic frameworks and cocoapods. Either the autogenerated umbrella file needs to import these files for use or RestKit needs to import these libraries using @import RKValueTransformers or #import <RKValueTransformers/RKValueTransformers.h>.

I am not an expert at Objective C, Cocoapods, or RestKit so looking to see if anyone has gotten this working and I am doing something wrong or if it requires a change made to RestKit.


回答1:


This is a bug currently in RestKit. Sam Giddin has an open PR right now that fixes the issue. I made a fork of RestKit that I'm using in my project with the commits from the PR to get around this issue until they merge in the fixes and make a new release.




回答2:


I posted an answer to a similar question

Here a straight blunt copy of the answer, so this is not a link-only answer :)

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! :)



来源:https://stackoverflow.com/questions/28037076/fail-to-import-restkit-with-cocoapods-dynamic-frameworks

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