Xcode encapsulates the. Bundle file and xcode encapsulates the. bundle file.

Source: Internet
Author: User

Xcode encapsulates the. Bundle file and xcode encapsulates the. bundle file.

There is often a need to encapsulate your own modules or open classes into static libraries for convenient calls.

However, when your module needs to use a large number of xib, images, audio or other resource files, it cannot be added to the static library. In this case, some resource files need to be encapsulated into the. Bundle file. The encapsulated items should contain three types of files:

1: Open header files (including complete call notes)

2: The suffix of the static library file is..

3: Bundle file, used to store various resource files.


Everything else is very simple: here we will talk about the bundle file encapsulation (in fact, it is also very simple)


Step 1: Create a Bundle Project
























Select the Bundle file type and create a project.


Step 2: Modify BuildSetting settings

1. Change the Base SDK to iOS6 or another existing iOS SDK version.

2: Modify ubuntures to armv7 armv7s







Step 3: add the resource file to be added

























Step 4: Build (this can be compiled successfully without using a Certificate)





In this way, your Bundle is generated.


You only need to reference it to the project during the call.

If you want to call it in a non-mainBundle place. The Bundle needs to be loaded.



NSBundle * buddle = [NSBundlebundleWithPath: @ "your bundle file storage path"];

[Buddle load]; // This step must be executed; otherwise, the buddle is invalid.



In this way, you can put this bundle in any path and call it.


What is the bundle file used in xcode42?

Expand the bundle to see that it is essentially a folder.
In ios development, you can use bundle to manage resource files and international information.
The creation method is available on the Internet. I'll stick it to you.
1. Create a folder
2. Rename the folder to a. bundle.
3. Drag a. bundle into xcode.
When you change the name, you will ask if you are sure to add the extension. bundle. You will find that the icon will become a toy block.
For more information, see the official Bundle Programming Guide to describe the differences between Bundles and Packages.

New to xcode, the project copied from the same project can be deployed on the device only when the interface is different. How can this problem be changed?

Modify the Bundle identifier in the Info. plist file. You can change it to a different one. This is the unique identifier of the machine Differentiation Program.

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.