On iOS, how do I create my own framework?

Source: Internet
Author: User

On iOS, how do I create my own framework? (Not a static database)

Please refer to the question on stackoverflow:

Http://stackoverflow.com/questions/4065052/how-to-build-a-framework-or-library-for-other-developers-the-secure-way

Solution

1. Run the command line script

Http://www.cocoanetics.com/2010/04/making-your-own-iphone-frameworks/

Evolved from the cocoa framework

2. Use hack bundle

Http://www.cocoanetics.com/2010/05/making-your-own-iphone-frameworks-in-xcode/

This method has been translated by enthusiastic students.

Http://www.cocoachina.com/bbs/read.php? Tid-75680.html

However, two frameworks need to be created, which correspond to simulator and device respectively.

This method here also has a detailed introduction to http://db-in.com/blog/2011/05/creating-universal-framework-to-iphone-ios/

3. Use others' templates

Https://github.com/kstenerud/iOS-Universal-Framework

This is a collective achievement. Of course, the author has stated that this is also false and cannot be used as freely as the built-in framework of the SDK.

The pldatabase framework on code Google can be the same as the SDK's own framework. A framework runs on both the simulator and the real machine.

Http://code.google.com/p/pldatabase/

To be studied, please try again later

Supplement:

Pldatabase framework only generates two static libraries (. A) and then merges them through lipo, but this is good.

Scripts In Lipo binary are as follows:

Framework = "$ {built_products_dir}/$ {product_name}. Framework"

Lipo \
"$ {Build_dir}/$ {configuration}-iPhone OS/libPlausibleDatabase-iPhoneOS.a "\
"$ {Build_dir}/$ {configuration}-iphonesimulator/libPlausibleDatabase-iPhoneSimulator.a "\
-Create-output "$ {framework}/versions/current/$ {product_name }"

Cd "$ {framework}" & ln-SF "versions/current/$ {product_name }"./

It seems that the above method does not produce a real framework. The so-called framework is either a hack bundle or a hack.
Static lib

The second method can be implemented because the framework is actually a bundle.
(A structured directory ),

Refer to Apple's official instructions http://developer.apple.com/library/mac/#documentation/General/Conceptual/DevPedia-CocoaCore/Framework.html


See: http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WhatAreFrameworks.html%23//apple_ref/doc/uid/20002303-BBCEIJFI

What are frameworks?

AFrameworkIs a hierarchical directory that encapsulates shared resources, such as a dynamic shared library, NIB files, image files, localized strings, header files, and reference documentation in a single package. Multiple applications can
Use all of these resources simultaneously. The system loads them into memory as needed and shares the one copy of the resource among all applications whenever possible.

A framework is also a bundle and its contents can be accessed using core Foundation bundle services or the cocoa nsbundle class. however, unlike most bundles, a framework bundle does not appear in the finder as an opaque file. A framework bundle is a standard
Directory that the user can navigate. This makes it easier for developers to browse the framework contents and view any attached ded documentation and header files.

Frameworks serve the same purpose as static and dynamic shared libraries, that is, they provide a library of routines that can be called by an application to perform a specific task. for example, the Application Kit and foundation frameworks provide the programmatic
Interfaces for the cocoa classes and Methods. frameworks offer the following advantages over static-linked libraries and other types of dynamic shared libraries:

  • Frameworks group related, but separate, resources together. This grouping makes it easier to install, uninstall, and locate those resources.

  • Frameworks can include a wider variety of resource types than libraries. For example, a framework can include any relevant header files and documentation.

  • Multiple versions of a framework can be stored in the same bundle. This makes it possible to be backward compatible with older programs.

  • Only one copy of a Framework's read-only resources reside physically in-memory at any given time, regardless of how many processes are using those resources. this sharing of resources has CES the memory footprint of the system and helps improve performance.

Note:Frameworks are not required to provide a programmatic interface and can include only resource files. However, such a use is not common.

The Darwin layer contains extends static and dynamic libraries but otherwise, most Mac OS X interfaces are packaged as frameworks. some key frameworks-including carbon, cocoa, application services, and core services-provide convenient groupings of several smaller
But related frameworks. These framework groups are calledUmbrella frameworksAnd they act as an alternative action layer between a technology and the subframeworks that implement that technology.

In addition to using the system frameworks, you can create your own frameworks and use them privately for your own applications or make them publicly available to other developers. private frameworks are appropriate for code modules you want to use in your
Own applications but do not want other developers to use. Public frameworks are intended for use by other developers and usually include headers and documentation defining the framework's public interface.

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.