I need to create a compiled framework for distribution to third parties.
I am using cocoa-pods
to handle my dependencies.
In order to accomplish this, it would seem that that creating a dynamic linked framework is the best option, but I am not sure and open to suggestions.
The steps I took are:
- I created a wrapper project to contain the framework target
- Inside the wrapper project I added a new target "Cocoa touch framework" - "MyFramework"
- All of the relevant code is added to the target
- Added import statements to the .h file of the framework per the generated comment // In this header, you should import all the public headers of your framework using statements like #import
- Created a podfile - "pod init"
- Added the framework dependencies to the podfile
The podfile looks like:
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
target 'Wrapper' do
end
target 'InnerFramework' do
platform :ios, '7.0'
pod "AFNetworking", "~> 2.0"
end
I need to distribute the framework using the "InnerFramework
" target.
This is where I get stuck -
The framework needs to contain all of the pod dependencies as well as be able to run in a simulator and on an actual device (From the customer perspective)- The framework also needs to be compliant with app store submission rules , i.e. arm 64bit etc.
The end user can have no access to the original source code - so I can't expect them to recompile.
The end user may also be using AFNetworking
, and it may be a different version , i.e. "1.0"
When I tried to integrate the framework to a test project I got runtime exceptions as well as compile time errors (depending on the flags I set in the build rules).
I've tried to copy the framework into a test project
Then in "Build phases" I added "Copy files" and add "Inner framework" with check box next to "Code sign on copy"
I get error "Could not build module 'InnerFramework'"
if I import the framework header to the test project code
If I don't import the framework header I get a runtime crash