IOS-xcode4-based IOS framework creation tutorial

Source: Internet
Author: User

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];

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.