问题
I'm creating a private pod and would like it to be used as a module. According to Using Pod Lib Create, in CocoaPods.org:
The first question you're asked is what language you want to build a pod in. For both choices CocoaPods will set up your library as a framework.
In fact, when I run pod lib create MyLibrary
, the initial project template they generate does have everything configured to be a framework, so that I can add a class to Development Pods/MyLibrary
, and access methods of that class from the sample project simply by importing the module using @import MyLibrary;
(or import MyLibrary
, in Swift).
The problem lies on the fact that the same page tells us
With the questions over, we run
pod install
on the newly created Project.
And as soon as I do that, the module-related files are gone, and all the files that I had added to my Development Pods
folders are gone. Not only that, the framework Target itself is gone, so it's not even a matter of simply adding the files back again.
What's the correct approach here? I don't seem to find anyone with the same problem.
I'm running Cocoapod v1.5.3
Any help is highly appreciated!
tl;dr:
pod lib create MyLibrary
cd MyLibrary/Example
pod install
- Now notice that the project has no module configuration anymore. How can I avoid this?
回答1:
According to the same page:
[!] Note: Due to a Development Pods implementation detail, when you add new/existing files to Pod/Classes or Pod/Assets or update your podspec, you should run pod install or pod update.
In my experience, you have to be very careful when adding new files because they may end up on a different folder than the expected Pods/Classes
.
When in doubt, I go to the folder containing the project and search for the missing file and move it to the correct folder.
来源:https://stackoverflow.com/questions/50661098/how-do-i-create-a-cocoapod-framework-and-add-files-to-it