IOS framework production tutorial. This is not a static package !!! We Use A work und to create IOS
Framework The preceding steps are as follows:
1. Open xcode to create a" Cocoa Touch static library, and delete the existing target.
2. Right-click the project and select Add new target. In the pop-up window, find cocoa and select "loadable bundle" in the right-side window of cocoa ".
Note: Do not select
Framework , Should be
Framework It is on Mac OS. IOS does not support it, but IOS supports "loadable bundle (cfbundle )"
3. Right-click get info on target and set the following five items under build settings:
A. Search wrapper extension and change the default bundle
Framework .
B. Modify Mach-O type to relocatable object file.
C. Disable dead Code Stripping, remove the check box!
D. Disable link with standard libraries.
E. Remove all references for "appkit" and "Foundation", delete all values of "other linker flags", and delete the value of "gcc_prefix_header!
4. Change the bundle OS type code value bndl to fmwk in the frameworks info. plist file, and change the type to fmwk under the Properties tab in the get info window of target.
5. Add your Code .
For example, we add a class
# Import <Foundation/Foundation. h>
@ Interface help: nsobject {
}
-(Void) show;
@ End
# Import "Help. H"
@ Implementation help
-(Void) show
{
Nslog (@ "framework !!! ");
}
@ End
6. Right-click "add --- new build phase --- new copy headers build phase" on the target, and a gray File Folder-copy headers.
7. Drag the. h file of the help class we just added from the top to the copy headers below, and right-click the folder-set role --- public.
8. From the above
Framework Drag the. M file to the compile Sources folder under target.
9. Compile. If an error occurs, set "Other linker flags" to-objc,-all_load, and-lxml2 under build. Do not write them together. Add one item.
Note: If a large number Error , Indicating that you have not deleted the "appkit" and "foundation" references,
After compilation, refer:
Under build/debug-iphonesimulator,Framework Folder:
Use Framework
Import in new project Framework
Copy the created kibernet. Framework to the directory of the new project and select the kibernet. Framework folder.
Added
Use Framework Class:
Import header files
# Import "testframeworkviewcontroller. H"
# Import <kibernet/help. h>
@ Implementation testframeworkviewcontroller
Test in viewdid load:
-(Void) viewdidload {
[Super viewdidload];
Help * Help = [[help alloc] init];
[Help show];
[Help release];
}
Output result: