简体   繁体   中英

Cocoa Touch Framework class dependencies

I've got a Cocoa Touch Framework for iOS8 (obviously) with XCode 6.3 that includes both Swift and ObjC classes. This framework is going to be used in a variety of other projects and requires AFNetworking.

Now I could just copy the AFNetworking files into the framework, but in case the other projects require AFNetworking as well (and add AFNetworking as well via source code or CocoaPods), the project will throw warnings because the AFNetworking classes are included in both the framework and the project and the compiler can't device which one to use.

However, if I don't add the AFNetworking files to the framework, I can't use them, obviously. In my framework development project I've tried to add AFNetworking only to the main project and not the framework, but the framework project still can't find them. Is there a way to have the framework project reference classes from the project that implements it?

If the framework is a project of yours, enable cocoapods on the framework project, add AFNetworking as a pod dependency on that. Doing that you should be able to reach AFNetworking classes from both the framework and the main project that uses it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM