Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding a pod to a universal framework library using cocoapods

am using CocoaPods 1.2 and i have a project with 2 targets, one is the main iPhone app and the other one is cocoa touch framework library.

I have no problem adding pods to my iphone target, my main problem is that i cannot add any pods to that other shared library target.

here is an example of my pod file:

platform :ios, '9.0'

target 'MyApp' do
  use_frameworks!
  pod 'EVReflection'
end

target 'MyLibrary' do
  use_frameworks!
  pod 'EVReflection'
end

adding pods to the main app MyApp works just fine but not to the other target, any ideas why this happens?

i have tried to use abstract_target but with no luck. i even tried to deintegrate and reintegrate but also not working.

the problem only happens when trying to add pods to universal framework library, adding pods to any other type of targets work just fine.

Any help would be appreciated.

like image 795
Ahmed Galal Avatar asked Feb 10 '17 23:02

Ahmed Galal


1 Answers

Here is my whole procedure

  1. crate a new swift app project.
  2. create a new cocoa touch framework target.
  3. in the project directory , run pod init
  4. Tyr This Podfile

    # Uncomment the next line to define a global platform for your project
    platform :ios, '9.0'
    
    target 'SOQ' do
      use_frameworks!
    end
    
    target 'SOQFW' do
      use_frameworks!
    end
    
    pod 'EVReflection'
    

after pod install, in both my two targets SOQ (swift app) and SOQFW (cocoa touch framework) can import EVReflection in *.swift and user class EVObject without a problem.

sample code is

import EVReflection

class User: EVObject {
    var id: Int = 0
    var name: String = ""
    var friends: [User]? = []
}

you can give it a try.

My development environment is os x 10.12 , xode 8.2.1 , cocoapods 1.1.1

like image 65
sunus Avatar answered Oct 12 '22 03:10

sunus