Follow these steps:
1. Create a cocoa touch static library (this won't happen, I believe everyone will)
2. Delete the target
3. Select File-new-target from the xcode menu, and then select
Note: No Bundel exists in the options of the IOS project, so select
4. Delete the Link Library in build phases (delete cocoa Framework)
5. Start to modify build setting
A. Select latest IOS (IOS 4.3) as the base SDK)
B. Build active architecture only select No
C. Set drad code stripping to no
D. The Mach-O type is relocatable object file.
E. link with standard libraries is no
F. Wrapper Extension: Change the default bundle to framework.
G. Select "standard" (armv6 armv7) in the ubuntures option (an error will be reported if this is not the case)
6. Change the bundle OS type code value bndl to fmwk in project Info.
7. Open the build phases tab and click Add build phase-add headers copy in the lower right corner. Then, a copy headers menu is displayed on the page, and the source file is added. After completion: (compile sources adds the. M file)
8. modify the code:
First, modify the header file contained in the TestFramework-Prefix.pch
# Import <Foundation/Foundation. h>
. H code:
@ Interface testframework: nsobject
+ (Void) testshow;
@ End
. M code
#import
"TestFramework.h"
@ Implementation testframework
+ (Void) testshow
{
Nslog (@ "testframework ");
}
9. Delete useless frameworks and red frameworks.
10. OK. Now you can execute the compilation. In case of exceptions, you will compile and generate the framework in the build directory.
Remember to compile and select the Simulator version or device version
11. Let's test the self-written framework.
Copy the generated framework to your project and add it to the project.
Add the following code:
# Import <testframework/testframework. h>
-(Void) viewdidload {
[Super viewdidload];
[Testframework testshow];
}