How to use CocoaPods with multiple Framework subprojects

后端 未结 3 1681
感情败类
感情败类 2021-01-31 16:29

First of all, I\'ve turned on use_framework! in Podfile.

Assume the main project is MAIN_APP, and two subprojects are FRAMEWORK_A and FRAMEWORK_B.

MAIN_APP require

3条回答
  •  误落风尘
    2021-01-31 17:00

    I'm not entirely sure your issue is the same as mine, but I'm going to leave my solution here just-in-case someone has a similar issue.

    I have a project with multiple sub-projects I use to modularize my code (and potentially prepare to extract to my own private pods). I had the issue of one importing an external pod to one of the sub-projects, and receiving a dyld error due to a "missing image".

    I found this Medium article from which I concluded that I had to always include the pods in the main project for the sub-projects to be able to find them. Neither of my external pods are used in the main project. ( https://medium.com/@akfreas/how-to-use-cocoapods-with-your-internal-ios-frameworks-192aa472f64b ) (I'm probably not writing the podfile as correctly or efficiently as I could, but this seems to fix my issue)

    My podfile is therefore as follows:

    abstract_target "RandomName" do
    
        target "MainProject" do
            inherit! :complete
            workspace './MainProject.xcodeproj'
            pod 'Moya', '~> 13.0'
            pod 'KeychainSwift', '~> 17.0'
        end
    
        target "ModuleA" do
          project './ModuleA/ModuleA.xcodeproj'
          workspace './ModuleA/ModuleA.xcodeproj'
          pod 'Moya', '~> 13.0'
        end
    
        target "ModuleB" do
          project './ModuleB/ModuleB.xcodeproj'
          workspace './ModuleB/ModuleB.xcodeproj'
          pod 'KeychainSwift', '~> 17.0'
        end
    end
    

提交回复
热议问题