Difference and connection between bundle and Package

Source: Internet
Author: User

 

Turn: http://blog.csdn.net/lmbda/article/details/17895619

 

Bundle is a convenient method for installing software provided by Apple.

Bundle provides a simple interface for users and developers.


Bundle and Package
Package: a directory that looks like a file
Bundle: a directory with a standard hierarchy that contains executable files and required resources. It looks like a file.

Package provides an abstract foundation for computers to better use. Applications or plug-ins on computers are actually a directory. This directory contains all required by an application, including executable code and resources. In the finder, this directory is considered a file. This makes application management easy.
Package is used to improve user experience, and bundle is further improved, making it easier for developers and operating systems. Bundle contains how code and resources are associated with applications. This organization method also facilitates localization.

How does the system differentiate bundle from package?

The Finder uses the following conditions to determine whether the package is used.
1. Specific extensions:. app,. Bundle,. Framework,. plugin,. kext, etc.
2. There is an extension declared as package by another application.
3. The package bit of the directory is set

Advantages of bundle
Bundle provides developers with many conveniences:
1. Because bundle is a directory level that contains application files. Therefore, resources in the bundle can be operated as files are normally operated.
2. the bundle structure is very convenient for multi-language support.
3. Bundle can be stored in different file systems
4. Users can easily install and remove applications.
5. Bundle looks like a file in case the file changes but the application is damaged.
6. Most executable files can be bundle.
7. Bundle is autonomous

Bundle type

1. Application

2. Frameworks

3. Plug-ins


Bundle Guide
1. Set an info. plist file for bundle. Make sure that the recommended keys are included.
2. If the application depends on a file, place it in the bundle. The application should contain images, character files, localization resources, and plug-ins used.
3. If you want to load C ++ code from the bundle, it is best to mark it as extern "C ". Bundle cannot recognize C ++ extensions.
4. nsbundle cannot load code fragment manager code. You need to use cfbundleref or cfpluginref
5. You must use the nsbundle object to load the Java code in the bundle.

6. nsbundle and cfbundleref can both load OC code. However, nsbundle is an inert load, while cfbundle is an immediate load. After the nsbundle is loaded, an nsbundledidloadnotification is sent.

 

What is in APP bundle?
1. info. plist (required) information property list, which contains the application configuration information. (It is an XML file)
2. executable (required) contains the application entry and static link code.
3. resourcefiles include images, icons, audio, NIB files, string files, configuration files, and data files. Resource files can

Use localized configuration for different languages
4. other Mac files can be embedded with advanced resources, such as private frameworks, plug-in, and document templates,

Custom Data. The custom framework or plug-in cannot be included in IOS.


IOS app bundle structure

MyApp. app
MyApp Executable File
Myappicon.png icon
Mysearchicon.png icon
Info. plist configuration information (bundle ID, version number, display name)
Pictures loaded by default.png
Mainwindow. Nib master NIB file (recommended)
Settings. Bundle preference settings
Mysettingsicon.png icon
Itunesartwork
En. lproj localization (language. lproj)
Myimage.png
Fr. lproj
Myimage.png

Key to be set in the info. plist File

Cfbundledisplayname: Application name
Identifier of the cfbundleidentifier Application
Cfbundleiconfiles is a group of icons used for applications.
Cfbundlefiles: A group of strings.
Lsrequiresiphonesos indicates whether it can only be run on iOS (true by default)
Uirequireddevicecapabilities

Keys generally required in info. plist
String name of the nsmainnibfile master NIB file
Uistatusbarstyle is a string that describes the style of the status bar when an application is loaded. The default value is uistausbarstyledefault.
Whether the status bar is hidden when the uistatusbarhidapplication is loaded
Orientation of the uiinterfaceorientation application when loading. The default value is uiinterfaceorientationportrait.
Whether the uiprerenderedicon application icon is highlighted
A boolean value of uirequirespersistentwifi indicates whether Wi-Fi network communication is used.
Uilaunchimagefile indicates the image string to be loaded. If this parameter is not set, the default value is default.

Localized Package Structure

En. lproj/
Customview. Nib
Bird.png
Bye.txt
Localizable. Strings
JP. lproj/
Customview. Nib
Bird.png
Bye.txt
Localizable. Strings

 

 

Difference and connection between bundle and Package

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.