IOS Create Cocoa Touch Static library (binary library) and bundle

Source: Internet
Author: User

Create bundle

New bundle Project, resource file (xib, picture, file ...) Drag in directly to compile.

Tai Keng: The direct iphone project is not built bundle project, build a x-code collapse once, began to think X-code6 how so weak, then the brain residual found himself in the iphone project to see the project Mac. (seemingly can be directly in the project to build a Mac project, but to change a lot of configuration such as ... or a new project for the convenience)

Note: The project quoted bundle xib to be so purple. (Loginbundle of course is the name of your new bundle)

-(ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) Nibbundleornil

{

NSString * Bundlepath = [[NSBundle mainbundle] Pathforresource: @ "Loginbundle" OfType: @ "bundle"];

NSBundle *resourcebundle = [NSBundle Bundlewithpath:bundlepath];

self = [Super initwithnibname:@ "Mxhomeviewcontroller" bundle:resourcebundle];

if (self) {

}

return self;

}

Create a static library

Create a new cocoa Touch Static Library project, drag the file you want to compile (except for the resource file). Note that you want to compile it once on both the real machine and the emulator. The. A file generated on the real machine can only be run on the real machine. The. A file generated on the same emulator can only be run on the emulator. If you want it to run on the emulator and run on the real machine, run on the command line (if you want to enter the directory). (Choose Debug or Release version as needed at run time)

Lipo-create Debug-iphoneos/liblogin.a debug-iphonesimulator/liblogin.a-output LOGIN.A Instructions true machine filename emulator filename output final filename

Tai Keng: First compiled on the simulator of the. A file is red, do not think that the compilation is wrong, in fact, has been compiled, the real machine on the compilation is directly compiled successfully black

God pit: Don't compile binaries for other projects

Sinkholes: note the reference to the library. If the static Library contains category (category), configure Otherlinker flags as-OBJC in the engineering file.

Very importent: To delete a build directory when importing a recompile static library, remove the program on the emulator. Because the static library is only loaded once.



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.