2

Steps to understand my problem:

1) I created a framework (My.framework)

2) Added My.framework as a subproject to MyApp.xcodeproj.

3) Then I ran cocoapod for adding AFNetworking on MyApp.xcodeproj.

4) Now, I open MyApp.xcworkspace.

5) While trying to access AFNetworking from classes in My.framework. It is not accessible.

P.S. I am not talking about "umbrella framework". (Umbrella framework is where we add a framework as a framework of sub project.)(Correct me here if I am wrong)

I just want to access AFNetworking while it is still out of the My.framework

Ramkrishna Sharma
  • 6,961
  • 3
  • 42
  • 51
jeet.chanchawat
  • 5,842
  • 5
  • 38
  • 59

3 Answers3

2

Add a podspec for your framework and include necessary dependencies such as AFNetworking.

 pod spec create

Then include your podspec in app's Podfile.

Ps: You don't have to publish your podspec, you can use it locally.

pronebird
  • 12,068
  • 5
  • 54
  • 82
  • Hi Andy, thanks for being here. I am getting "[!] Unknown command: `init`" while hitting this command. – jeet.chanchawat Oct 17 '16 at 08:33
  • Is it ... `pod spec create My` ? – jeet.chanchawat Oct 17 '16 at 08:38
  • 1
    @jeet.chanchawat yeah sorry, it's `create`. This should create a boilerplate pod spec file for you. Just if you work with Cocoapods then you better maintain everything through them too. Podspecs are great to describe complex dependencies and simplify things on the outside when you have to link your framework. Also, CocoaPods should take care of embedding frameworks for you. – pronebird Oct 17 '16 at 14:17
0

In my case , this is working.

Adjust Public Header files in Target-> Build Phase-> Copy Headers. We can set the header file visibility here.

enter image description here

Refer more : https://stackoverflow.com/a/27638841/3901620

Community
  • 1
  • 1
KKRocks
  • 8,222
  • 1
  • 18
  • 84
0

Another Way

whenever you don't use pod then use this.

IN Objective C

1) Import or simply Copy (drag and drop) AFNetworking or any other class which you use in your project.

enter image description here

2) Import it where you use.

enter image description here

Done now you can access it.

In Swift

You just import or copy third party class or framework in your project you don't need to import it where you use.

Mohit
  • 126
  • 2
  • 10