Cocoapods spec for external lib at http (shared location) - ios

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!

Related

RMStore openssl/pkcs7.h file not found

I am trying to use RMStore in order to verify the receipts locally. I have followed the instructions in order to add static ssl libaries: https://github.com/robotmedia/RMStore/wiki/Receipt-verification#adding-openssl
Transfered the 4 files, i downloaded binaries and headers.
1.In Build Phases, add libssl.a and libcrypto.a to Link Binary With Libraries.
2.In Build Settings, add the headers folder to the Header Search Paths.
At the second step above is where the issue exists(i think). At the moment the header search path is
$(PROJECT_DIR)/RMStore/Optional/openssl-1.0.1e/include
and the library search path:
$(PROJECT_DIR)/RMStore/Optional/openssl-1.0.1e/lib
Am i supposed to replace "RMStore" with my projects name? Where am i going wrong?
Also a side question(but relevant to openssl), when submitting to the App store, what do i answer to the "Is your product designed to use cryptography or does it contain or incorporate cryptography?" question? Do i have to apply for confirmation approval?
I separately installed openSSL via cocoapods and that solved my issue.
I used this one: https://cocoapods.org/pods/OpenSSL-Universal
but there are others available as well...
If you add folder OpenSSL to your project, and all files for OpenSSL will be there.
Add OpenSSL folder to the top of your Project (not in subfolders)
$(PROJECT_DIR)/OpenSSL/include - Header Search Paths
$(PROJECT_DIR)/OpenSSL/lib - Library Search Paths`
Just add $(PROJECT_DIR)/OpenSSL/include to Header Search Paths of Build Settings
OpenSSL Folder must be in root directory

Cocoapod spec file creates extra folders

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.

how to include a file in your hosting app for a cocoapod File

I have a private cocoapod to share common models and controllers at our company. There is a config file that needs to be included because it
is referenced in the Cocoapod file. For example, if we have:
sample-proj/Pods/OurClasses/Classes/MyViewController.m
which has
#import "ABCConfig.h"
and ABCConfig is in sample-proj, how would I tell it to include it correctly? We have a project for which this works correctly and I thought
it would adding $(SRCROOT) in Search Paths -> User Header Search Paths but this doesn't seem to do it (although this could be some wierd Xcode artefact).
I can infer the problem as specifying a set of config to the libarary/framework. You should rethink of how you set a config and `import "ABCConfig.h" is right or not. There are couple of options,
Modify config file after you do pod install (this will be lost with next pod install),
use different config as submodule and import corresponding module when installing pods
Expose an API to feed in the configuration to library (best approach - flexible for user to tweak and give their configuration).

Copy header files into include folder with CocoaPods

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

Xcode 4 - Header file not found when including 3rd party static lib

I am trying to check out Nocilla but I can't seem to get my test target to build when I include it. I cloned the Nocilla repo and built the static lib (targeting simulator) from source. I am linking the nocilla static lib to my test target.
I have all of Nocilla's public headers included in my project but for some reason Xcode complains that it cannot find headers which are located in the same relative location from which they are being referenced.
Trying to run my tests results in the following compilation error:
'LSHTTPRequest' file not found
Nocilla provides installation instructions which include using CocoaPods. I am not interested in using CocoaPods. Does anyone have any clues for me as to why my tests cannot find these header files? Am I missing a build step to ensure they are copied to the test execution location?
Thanks!!
You must set the User Header Search Paths for the project that wants to include the static library headers:
The exact location of the header files will vary on the relative location between the two projects of course.

Resources