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.