- 浏览: 328155 次
- 性别:
- 来自: 杭州
-
文章分类
最新评论
-
arlenliugj:
才发现这贴子好早
如何在Ubuntu下安装windows7 -
arlenliugj:
请问一下,这样安装上windows会不会把已经装好的linux ...
如何在Ubuntu下安装windows7 -
zhaomengbin:
写的很不错,可以写个文件给合并的方法么?,将分割后的几份文件还 ...
文件分割程序 -
junhe0723:
3Q,刚出现这个问题解决了。
jvm terminated exit code 1 -
Anddy:
shell 双击选中太不智能了。
XSHELL快捷键设置
CF 意思是Core Foundation
bundle在ios和ox中是一个基本的技术,用来封装代码和资源文件的。
bundle使用目录和文件来管理,不管是在开发环境还是先上部署修改都非常容易。
Cocoa和Core Foundation都提供了对bundle内容编程的接口。
一个bundle是一个目录,以标准化的分层结构,它包含可执行代码和资源使用的代码。
不是所有的bundle都是以包的形式存在的。
如何知道是一个包文件,一般可以通过看包文件的扩展名来得到,比如.app, .bundle, .framework, .plugin, .kext
bundle的优势:
1:因为bundle在文件系统中是以目录的形式存在的,所以可以用基本的文件读取接口读取bundle
2:因为bundle的目录结构所致,所以可以很容易就支持国际化
3:bundle可以存在不同的文件系统中
4:用户可以容易的安装,移动,删除bundle
5:大部分bundle还是包,所以不容易受到外部用户对关键资源的操作
6:bundle支持intel系列的芯片,以及32位和64位的机器
7:大多数可执行的代码都是使用bundle的,Applications, frameworks (shared libraries), and plug-ins都支持bundle模型,但是动态库,静态库,脚本,命令行等不支持bundle结构
bundle的几种类型:
Application
Frameworks
Plug-Ins:OS X支持,方便应用动态加载不同的模块,有很多种plug-ins
创建bundle:一般当你创建一个xcode工程的时候,在你编译的时候,会自动生成bundle的
如果是objective-c语言开发的应用,可以使用NSBundle类来获取和管理bundle,如果是c开发的应用,可以使用关联CFBundleRef类型的方法来获取和管理bundle。
使用NSBundle来加载java代码,使用CFBundleRef or CFPlugInRef类型来加载Code Fragment Manager (CFM)代码和c、c++代码。
Application bundle包含文件:info.plist(应用的配置文件)、可执行文件、资源文件、支持文件
Info.plist文件属性:
CFBundleDisplayName:应用的显示名称,在icon下面的
CFBundleIdentifier:com.company.application(一般这样)
LSRequiresIPhoneOS:指定app能在那个ios版本上使用
CFBundleVersion:应用版本号
NSMainNibFile:指定应用的主nib文件
UIStatusBarStyle:
UIStatusBarHidden:
UIInterface-Orientation:
UIRequiresPersistent-WiFi:设置为true,app只能在wifi场景下使用
Framework Bundles:
Mac OS X 扩展了 framework 的功能,让我们能够利用它来共享代码和资源。framework 在概念上有点像 Window 下的库,但是比库更加强大,通过 framework 我们可以共享所有形式的资源,如动态共享库,nib 文件,图像字符资源以及文档等。系统会在需要的时候将 framework 载入内存中,多个应用程序可以同时使用同一个 framework,而内存中的拷贝只有一份。一个 framework 同时也是一个 bundle,我们可以在 finder 里浏览其内容,也可以在代码中通过 NSBundle 访问它。
与动态/静态库相比,framework 有如下优势:
第一,framework 能将不同类型的资源打包在一起,使之易于安装,卸载与定位;
第二,framework 能够进行版本管理,这使得 framework 能不断更新并向后兼容;
第三,在同一时间,即使有多个应用程序使用同一 framework,但在内存中只有一份 framework 只读资源的拷贝,这减少了对内存的占用
如何创建一个framework bundle,可以查看Framework Programming Guide
可加载的bundle不能在IOS中使用,可加载的bundle的目录结构和应用bundle的目录结构差不多
指定国际化的格式:language _region .lproj
English speaking:for Great Britain (en_GB.lproj),Australia (en_AU.lproj), and the United States (en_US.lproj)
访问bundle内容:
如果是Cocoa框架的应用,定位和打开bundle
取回的bundle为空有几种情况:
1:应用没有被打包
2:程序启动的时候,可执行文件路径不对,这个路径可以通过PATH或者启动参数指定
通过指定PATH获取:
如果使用Core Foundation开发的应用:
取回plug-ins在应用中的目录
通过bundle id获取bundle:
只要你使用一个的NSBundle对象或CFBundleRef类型来定位资源,你不用担心资源是如何寻找的,它会按照一个优先级来。
没有bundle对象,也可以自己获取bundle里面的内容,通过NSFileManager类来操作,不过如果要获取多个资源文件,建议使用bundle对象。
获取单个文件
获取多个文件(cocoa工程)
获取bundle的plist文件中的内容
获取bundle的版本(using Core Foundation)
使用bundle加载object-c class
使用包来管理文件
当文件格式过于复杂,目录结构很多时候,或者有很多不同格式的文件,那么使用包来封装你的整个文件,使用NSFileWrapper来创建文件包,然后通过NSDocument类去读取你的资源文件。如果你使用的是bundle structure,那么你可以通过NSBundle or CFBundleRef类获取文件
打包步骤:
1:定义文档结构
2:注册文档类型
3:创建包
bundle在ios和ox中是一个基本的技术,用来封装代码和资源文件的。
bundle使用目录和文件来管理,不管是在开发环境还是先上部署修改都非常容易。
Cocoa和Core Foundation都提供了对bundle内容编程的接口。
一个bundle是一个目录,以标准化的分层结构,它包含可执行代码和资源使用的代码。
不是所有的bundle都是以包的形式存在的。
如何知道是一个包文件,一般可以通过看包文件的扩展名来得到,比如.app, .bundle, .framework, .plugin, .kext
bundle的优势:
1:因为bundle在文件系统中是以目录的形式存在的,所以可以用基本的文件读取接口读取bundle
2:因为bundle的目录结构所致,所以可以很容易就支持国际化
3:bundle可以存在不同的文件系统中
4:用户可以容易的安装,移动,删除bundle
5:大部分bundle还是包,所以不容易受到外部用户对关键资源的操作
6:bundle支持intel系列的芯片,以及32位和64位的机器
7:大多数可执行的代码都是使用bundle的,Applications, frameworks (shared libraries), and plug-ins都支持bundle模型,但是动态库,静态库,脚本,命令行等不支持bundle结构
bundle的几种类型:
Application
Frameworks
Plug-Ins:OS X支持,方便应用动态加载不同的模块,有很多种plug-ins
创建bundle:一般当你创建一个xcode工程的时候,在你编译的时候,会自动生成bundle的
如果是objective-c语言开发的应用,可以使用NSBundle类来获取和管理bundle,如果是c开发的应用,可以使用关联CFBundleRef类型的方法来获取和管理bundle。
使用NSBundle来加载java代码,使用CFBundleRef or CFPlugInRef类型来加载Code Fragment Manager (CFM)代码和c、c++代码。
Application bundle包含文件:info.plist(应用的配置文件)、可执行文件、资源文件、支持文件
Info.plist文件属性:
CFBundleDisplayName:应用的显示名称,在icon下面的
CFBundleIdentifier:com.company.application(一般这样)
LSRequiresIPhoneOS:指定app能在那个ios版本上使用
CFBundleVersion:应用版本号
NSMainNibFile:指定应用的主nib文件
UIStatusBarStyle:
UIStatusBarHidden:
UIInterface-Orientation:
UIRequiresPersistent-WiFi:设置为true,app只能在wifi场景下使用
Framework Bundles:
Mac OS X 扩展了 framework 的功能,让我们能够利用它来共享代码和资源。framework 在概念上有点像 Window 下的库,但是比库更加强大,通过 framework 我们可以共享所有形式的资源,如动态共享库,nib 文件,图像字符资源以及文档等。系统会在需要的时候将 framework 载入内存中,多个应用程序可以同时使用同一个 framework,而内存中的拷贝只有一份。一个 framework 同时也是一个 bundle,我们可以在 finder 里浏览其内容,也可以在代码中通过 NSBundle 访问它。
与动态/静态库相比,framework 有如下优势:
第一,framework 能将不同类型的资源打包在一起,使之易于安装,卸载与定位;
第二,framework 能够进行版本管理,这使得 framework 能不断更新并向后兼容;
第三,在同一时间,即使有多个应用程序使用同一 framework,但在内存中只有一份 framework 只读资源的拷贝,这减少了对内存的占用
如何创建一个framework bundle,可以查看Framework Programming Guide
可加载的bundle不能在IOS中使用,可加载的bundle的目录结构和应用bundle的目录结构差不多
指定国际化的格式:language _region .lproj
English speaking:for Great Britain (en_GB.lproj),Australia (en_AU.lproj), and the United States (en_US.lproj)
访问bundle内容:
如果是Cocoa框架的应用,定位和打开bundle
//objective-c语言获取bundle NSBundle* mainBundle; // Get the main bundle for the app. mainBundle = [NSBundle mainBundle]; //c、c++语言获取bundle CFBundleRef mainBundle; // Get the main bundle for the app mainBundle = CFBundleGetMainBundle();
取回的bundle为空有几种情况:
1:应用没有被打包
2:程序启动的时候,可执行文件路径不对,这个路径可以通过PATH或者启动参数指定
通过指定PATH获取:
NSBundle* myBundle; myBundle = [NSBundle bundleWithPath:@"/Library/MyBundle.bundle"];
如果使用Core Foundation开发的应用:
CFURLRef bundleURL; CFBundleRef myBundle; // Make a CFURLRef from the CFString representation of the // bundle’s path. bundleURL = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, CFSTR("/Library/MyBundle.bundle"), kCFURLPOSIXPathStyle, true ); // Make a bundle instance using the URLRef. myBundle = CFBundleCreate( kCFAllocatorDefault, bundleURL ); // You can release the URL now. CFRelease( bundleURL ); // Use the bundle... // Release the bundle when done. CFRelease( myBundle );
取回plug-ins在应用中的目录
CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef plugInsURL; CFArrayRef bundleArray; // Get the URL to the application’s PlugIns directory. plugInsURL = CFBundleCopyBuiltInPlugInsURL(mainBundle); // Get the bundle objects for the application’s plug-ins. bundleArray = CFBundleCreateBundlesFromDirectory( kCFAllocatorDefault, plugInsURL, NULL ); // Release the CF objects when done with them. CFRelease( plugInsURL ); CFRelease( bundleArray );
通过bundle id获取bundle:
//cocoa NSBundle* myBundle = [NSBundle bundleWithIdentifier:@"com.apple.myPlugin"]; //core funduction CFBundleRef requestedBundle; // Look for a bundle using its identifier requestedBundle = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.Finder.MyGetInfoPlugIn") );
只要你使用一个的NSBundle对象或CFBundleRef类型来定位资源,你不用担心资源是如何寻找的,它会按照一个优先级来。
没有bundle对象,也可以自己获取bundle里面的内容,通过NSFileManager类来操作,不过如果要获取多个资源文件,建议使用bundle对象。
获取单个文件
//cocoa工程 NSBundle* myBundle = [NSBundle mainBundle]; NSString* myImage = [myBundle pathForResource:@"Seagull" ofType:@"jpg"]; //core funduction工程 CFURLRef seagullURL; // Look for a resource in the main bundle by name and type. seagullURL = CFBundleCopyResourceURL( mainBundle, CFSTR("Seagull"), CFSTR("jpg"), NULL );
获取多个文件(cocoa工程)
//cocoa工程 NSBundle* myBundle = [NSBundle mainBundle]; NSArray* myImages = [myBundle pathsForResourcesOfType:@"jpg" inDirectory:nil]; //core funduction工程 CFArrayRef birdURLs; // Find all of the JPEG images in a given directory. birdURLs = CFBundleCopyResourceURLsOfType( mainBundle, CFSTR("jpg"), CFSTR("BirdImages") );
获取bundle的plist文件中的内容
CFDictionaryRef bundleInfoDict; CFStringRef myPropertyString; // Get an instance of the non-localized keys. bundleInfoDict = CFBundleGetInfoDictionary( myBundle ); // If we succeeded, look for our property. if ( bundleInfoDict != NULL ) { myPropertyString = CFDictionaryGetValue( bundleInfoDict, CFSTR("MyPropertyKey") ); }
获取bundle的版本(using Core Foundation)
// This is the ‘vers’ resource style value for 1.0.0 #define kMyBundleVersion1 0x01008000 UInt32 bundleVersion; // Look for the bundle’s version number. bundleVersion = CFBundleGetVersionNumber( mainBundle ); // Check the bundle version for compatibility with the app. if (bundleVersion < kMyBundleVersion1) return (kErrorFatalBundleTooOld);
使用bundle加载object-c class
- (void)loadBundle:(NSString*)bundlePath { Class exampleClass; id newInstance; NSBundle *bundleToLoad = [NSBundle bundleWithPath:bundlePath]; if (exampleClass = [bundleToLoad principalClass]) { newInstance = [[exampleClass alloc] init]; // [newInstance doSomething]; } }
使用包来管理文件
当文件格式过于复杂,目录结构很多时候,或者有很多不同格式的文件,那么使用包来封装你的整个文件,使用NSFileWrapper来创建文件包,然后通过NSDocument类去读取你的资源文件。如果你使用的是bundle structure,那么你可以通过NSBundle or CFBundleRef类获取文件
打包步骤:
1:定义文档结构
2:注册文档类型
3:创建包
发表评论
-
URL System Programming Guide
2014-11-11 09:44 1227支持五种协议:ftp:// http:// ... -
Runtime programming guide
2014-10-26 01:23 1117objective-c有两个版本的ru ... -
OpenGL Programming Guide
2013-04-16 10:10 0XXXXXX -
Location Awareness Programming Guide
2013-04-14 12:19 0两个核心的framework: Cor ... -
Audio Session Programming Guide
2013-04-11 20:32 2921Audio Session:自己开发的应用和IOS应用程序处理 ... -
Event programming guide
2013-04-09 19:02 2132Phone中处理触摸屏的操作,在3.2之前是主要使用的是由UI ... -
Instruments User Guide
2013-04-02 19:32 0打开Instruments方式: 1:Xcode > O ... -
CFNetwork Programming Guide
2013-04-01 20:40 4274CFNetwork封装了具体的网路实现,可以通过CFxxx等a ... -
Core Data Tutorial
2013-03-20 15:20 1568core data支持IOS 3以后的系统。 Core Dat ... -
ios 国际化
2013-03-19 16:25 0需要你本身的应用支持国际化,主要是project->in ... -
view controller program guide
2013-03-13 13:22 0navigation controller A view c ... -
ad hoc证书
2013-02-28 23:22 1685iOS证书分2种,1种是开发证书,用来给你(开发人员)做真机测 ... -
iOS App Programming Guide
2013-03-13 11:24 2770用户界面的选择: 1:堆积方式:sdk提供的控件,你一个一个往 ... -
使用vpn在mac
2013-02-25 19:25 0http://blog.sina.com.cn/s/blog_ ... -
为APNS制作和生成证书
2013-02-25 17:32 0首先制作一个证书申请文件(.csr)文件,然后创建一个appi ... -
安装苹果的ipa文件到iphone
2013-02-22 17:29 3352苹果的ipa文件安装方式有好多种,我介绍的是最常用的安装ipa ... -
About the Tools Workflow for iOS
2013-02-26 21:51 2157查看自己的开发角色是agent、admin、member。 只 ... -
基本概念
2013-02-21 22:27 0ios开发准备流程:http://hi.baidu.com/s ... -
About the iOS Technologies(关于 iOS 技术简介)
2013-02-21 14:30 995官方文档:https://developer.apple.co ... -
Doxygen for Xcode
2013-02-21 10:53 1904IOS Developer Library 中的article ...
相关推荐
这份文档名为“iPhone App Programming Guide”,是一份苹果公司为iOS平台iPhone应用程序开发者提供的编程指南。文档详细介绍了iOS应用架构、应用生命周期、后台执行策略、隐私保护、性能优化等多个方面的内容。接...
开发者需要了解如何构建有效的应用捆绑包(Bundle),并利用这些知识开始应用创建的过程。 在管理应用状态和多任务处理方面,文档指导开发者如何管理应用状态变化,以及如何处理应用的启动周期。应用在后台和前台之间...
- **AppBundle管理**:AppBundle包含了应用的所有资源和配置信息,是应用的重要组成部分。 #### 四、应用状态与多任务处理 - **状态管理**:有效地管理应用状态变化,如切换到后台时保存状态,在返回前台时恢复...
Beginners Guide to Learn Data Analytics, Predictive Analytics and Data Science with Python Programming (Hacking Freedom and Data Driven) by Isaac D. Cody English | 28 Dec. 2016 | ISBN: 1541334574 | ...
收据验证的具体实现过程中,会涉及到多个字段的解析,例如App收据字段包含了BundleIdentifier、App版本、不透明值等信息,而App内购买项目收据字段则包括产品标识符、交易标识符、购买日期等。这些字段都有特定的...
此外,应用包(App Bundle)是应用程序的容器,包含了编译后的代码、资源文件、故事板、nib文件、图像和其他媒体文件等。 在应用程序状态和多任务处理方面,文档详细说明了应用状态的管理,包括应用启动周期、处理...
With this digital Early Release edition of Programming JavaScript Applications, you get the entire book bundle in its earliest form—the author's raw and unedited content—so you can take advantage of...
Excel VBA: A Step-By-Step Comprehensive Guide on Advanced Excel VBA Programming Techniques and Strategies Excel VBA : A Step-by-Step Comprehensive Guide on Excel VBA Programming Tips and Tricks for ...
入门安装部门: yarn && bundle install 。 运行postcss来编译顺风: yarn build 。 告诉jekyll服务该网站: jekyll serve 。发展如果要编辑样式,则可能需要运行yarn watch ,当相关文件发生更改时,它将重新构建...
### iPhone App Programming Guide #### 关于 iOS 应用程序编程 在《iPhone App Programming Guide》这份文档中,主要介绍的是如何开发适用于 iOS 平台的应用程序。文档详细地阐述了从设计到实现整个过程中的各个...
Title: Android Games Practical Programming By Example: Quickstart 1 (Volume 1) Author: Fred Yang Length: 140 pages Edition: 1 Language: English Publisher: CreateSpace Independent Publishing Platform ...
"Scala: Guide for Data Science Professionals (Learning Path)" ASIN: B06XCJVY21, eISBN: 1787282856 | 2017 | True PDF | 1100 pages | 15 MB Scala will be a valuable tool to have on hand during your data...
- **Improved Performance**: Angular 15 focuses on improving overall performance, including faster change detection, reduced bundle sizes, and optimized bootstrapping. - **Improved Forms**: Enhanced ...
- **依赖注入与面向方面编程**:依赖注入(Dependency Injection, DI)和面向方面编程(Aspect-Oriented Programming, AOP)等新思想被广泛应用于应用程序管理中,以降低复杂度并简化代码结构。 - **应用程序部署挑战**...
Package all of that together into a profitable bundle We’ll also suggest a group of easy to tackle projects that are centered on Raspberry Pi. If you have ever wanted to become an entrepreneur, there...
You’ll also receive updates when significant changes are made, new chapters are available, and the final ebook bundle is released.The programming landscape of natural language processing has changed...