I created new cocoapod project by using pod lib create, changed folder name, edited spec file and updated example project.
In the screenshot you can see that the extra folders have been created. What is my mistake and how to correct it?
Thanks a lot...
Screenshot: https://cloud.githubusercontent.com/assets/7072397/12080819/b191e36c-b278-11e5-8bda-9569795d536b.png
You are not making any mistake, but .podspec file is meta data file for Pod.
A specification describes a version of Pod library. It includes details about where the source should be fetched from, what files to use, the build settings to apply, and other general metadata such as its name, version, and description.
You can get more detail about Pod Specification file from Cocoapods site.
Related
I've been developing iOS apps for about 18 months now, and I am mostly self-taught. I was recently hired and brought onto a very large project with a lot of moving pieces. I'd like to provide a broad outline for the owner of the application who hired me and I also want to do a security check before presenting the outline to him and others, as well as suggest to him that we should ultimately hire an iOS security expert.
Moreover, after a brief overview of the project, I’ve found a few things that stick out to me and I was wondering if they also stick out to anyone viewing this post:
Below the main project file, there is a Xcode project file, named: 'Pods'
Project - Pods
Podfile:
(Lists all pods); will do a separate post for specifics on this).
Frameworks:
(Contains all frameworks from cocoa pods we use).
Pods:
(Contains many folders, each named after each cocoa pods pod we use).
Products:
(List all of the cocoa pods we use, followed by a .framework after each).
Ex: 'Alamofire.framework'
Targets Support Files:
Contains two folders:
1. Pods-UberApp-Uber
2. Pods-UberApp-UberDev
In each of the two folders within 'Targets Support Files' the following files exist (image link below), with the beginning (for the first set of items within the first file) being 'Pods-UberApp-Uber' or (for the second set of items within the second file) 'Pods-UberApp-UberDev':
Screenshot of 'Pods-UberApp-Uber' / 'Pods-UberApp-UberDev' file items, previously described
What are these files and are they present for every Xcode project/iOS app?
Note: Uber is just the demo name of the app for sake of privacy and understanding. Thx.
These files are autogenerated by cocoapods
The only file that you may edit in Pods project, is Podfile. It contains all your dependencies, and may contain some custom settings for configuring them.
If you open Podfile location in the file system, you'll find Podfile.lock nearby: it contains all versions for installed dependencies since the last pod install or pod update. You can try removing Pods folder and run pod install from terminal inside folder with Podfile, it should recreate the Pods directory.
So all these files on your screenshot are just needed by Xcode to build dependencies for you.
I had a framework named TCXXXXX.framework can only be added to project by manual.
In addition, I had created a Share repo by CocoaPods's command pod lib create STShare.
I had try to add TCXXXX.framework and TCXXXX.bundle into STShare's Classes document. However, it work wired. TCXXXX.framework and TCXXXX.bundle changed to a document view in Xcode( The bundle and framework icon just disappeared).
By the way, it couldn't build succeed because STShare couldn't found the class in TCXXX.framework.
I want to know how to add framework to STShare repo by manual?
Sorry, I answer by myself. (Too much time for answer, and I found by myself)
I can fulfill the requirement by specify s.framework line in STShare.podspec file.
I developing a library and I have next use case. For instance, I have project A that has dependency on project B. I want to setup my pod in project B, so both project A and project B have access to my pod functions. So dependency chain will look like:
My Lib
|
B
|
A
Actual code will be compiled and available in runtime in project A almost automatically, but I can't compile it because project A does not see header files from my library. The header files places in Pods/MyLib/MyLib/CustomIdentifier directory (because s.header_dir = 'CustomIdentifier' to have access with import like: #import <CustomIdentifier/Header.h>).
I don't want to specify in project A direct path to header file (I do not want user have to do additional action to install my lib). I want CocoaPods to copy my header files or links to them into Products/../include folder so they will be available automatically.
How can I do it? Preferably with podspec file.
Thank you for you help!
Looks like it has to do with folder paths
Quoting from docs:
header_mappings_dir
A directory from where to preserve the folder structure for the
headers files. If not provided the headers files are flattened.
Examples:
spec.header_mappings_dir = 'src/include'
Helped me with a similar issue.
s.header_mappings_dir = 'armadillo-4.200.0/include/' #allows any folders in here to be avail from project. Namely the folder of headers, armadillo_bits
http://guides.cocoapods.org/syntax/podspec.html#header_mappings_dir
I've been trying to upgrade the Facebook iOS SDK used in my app. I cloned the Git repo and copied everything across to the directory containing the old version, and attempted to build the project. However I get the error "FBDialogClosePNG.h" file not found. I can't find that filename anywhere in the repo, or anywhere else through Google. It appears that it is meant to be a wrapper class for an image, since it appears to be called through the following line:
UIImage* closeImage = [FBDialogClosePNG image];
Does anyone know what we're meant to do with this?
Removing Xcode's DerivedData directory and the generated Pods directory fixed this for me.
/Users/{username}/Library/Developer/Xcode/DerivedData
/{YourProject}/Pods
there is a file in the path {FB_SDK_DIR}/scripts/image_to_code.py which will generate a bunch of files including FBDialogClosePNG.h.
To get this file, you need to compile facebook's source codes using src/facebook-ios-sdk.xcodeproj first, then locate the DerivedSources folder, put the whole folder into your project.
And you will need a to switch off a lot of compiler warning before your code could compile. Then you should good to go
For me, it was because my Facebook-iOS-SDK pod didn't get fully updated for whatever reason. I deleted the Facebook-iOS-SDK folder from my Pods folder, then ran pod update again, and now the problem is fixed.
I was getting lots of missing files: FBDialogClosePNG.h, FBLikeButtonPopWAV.h, FBLikeButtonBackgroundPNG.h, FBLoginViewButtonPNG.h, FBPlacePickerViewGenericPlacePNG.h and FBProfilePictureViewBlankProfilePortraitPNG.h.
As per http://guides.cocoapods.org/syntax/podspec.html#source
There are different type of source type you can provide to download your depended library. Last one mentioned in that page is downloading from HTTP.
Using HTTP to download a compressed file of the code. It supports zip,
tgz, bz2, txz and tar.
spec.source = { :http =>
"http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip" }
My question:
What if i want to download lib from http e.g. myLib.a from http://mylocation.com/sharedlib/myLib.a.
Above help didn't support *.a and *.framework.
How to achieve it? What would be pod spec for me in this case.
Question updated (31st-Jan-2014)
I got answers on how to configure for http download. Thanks James for help.
One more question
Where to configure username/passoword if it is required to access *.zip at http source. As per my knowledge, cocoapods is using SSHkey funda instead of credential based authentication.
Is there any configuration in pod spec for credential entry?
When downloading your Pod code over HTTP, you'll likely want to provide it as a .zip file so that it can contain both your library (myLib.a) and any required header files. You could also provide these as part of a Git repository.
The best way to solve your problem is probably to take a look at some existing Podspecs that include the same sort of files that you're trying to include.
The Estimote SDK includes a .a library file and headers. The library is identified by the vendored_libraries property, and the headers are under source_files. The Podspec also updates the xcconfig so that the LIBRARY_SEARCH_PATHS and HEADER_SEARCH_PATHS point to the required files.
The Reveal SDK is downloaded over HTTP as a .zip file, and includes a .framework file, which is identified by the vendored_frameworks property. It also updates xcconfig to set the FRAMEWORK_SEARCH_PATHS build setting to point to the correct location.
I hope by looking at these two examples, you can determine what you need for your own Podspec!