简体   繁体   中英

Creating a CocoaPod from Cocoa Touch Framework

I have a Cocoa Touch Framework written in Swift that I wish to distribute as a CocoaPod.

The idea is that this will be a closed-source distribution since only the public headers are exposed.

In my podspec I have set the source as the github repo containing my framework. I have also added:

s.public_header_files = "mylibrary.framework/Headers/*.h"
s.preserve_paths = "mylibrary.framework"
s.vendored_frameworks = "mylibrary.framework"

I pushed this up to the trunk. When I install the pod in a new project, I import the module just fine, but it is unable to find the classes I am attempting to use from the framework.

Can someone tell me what the correct way to do this is?

The reason I was getting "Use of unresolved identifier" errors when I was trying to use my public classes is because my header file mylibrary-Swift.h was not getting exposed properly.

I was able to fix this issue by naming my header file explicitly in my podspec like this:

s.public_header_files = "mylibrary.framework/Headers/mylibary-Swift.h"

After I pushed this new podspec I am able to use my public classes and methods.

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