开发工具:
文件大小: 17mb
下载次数: 0
上传时间: 2014-01-03
详细说明: The next step is to select a physical location on the hard disk and a logical location within your project for your new class; that is, the file folder and the group folder. In this step (see Figure 1-26), you can also decide whether your class should be included in the target (the executable file). This is usually what you want, but there might be situations when you want to exclude files, such as when you have more than one target, like a unit-test target. Most of the time you can just accept the default values for the locati ons, so go ahead and click “Create.” Xcode then generates two new files for your project: MyClass.h and MyClass.m. They contain the code of an empty class, as in the header and implementation files shown in Listing 1-5 and Listing 1-6. Listing 1-5. A new class header file // // MyClass.h // My App // #import @interface MyClass : NSObject @end Listing 1-6. A new class implementation file // // MyClass.m // My App // #import "MyClass.h" @implementation MyClass @end Listing 1-8. A better way of handling potentially recoverable errors with a framework NSError *error = nil; if ([managedObjectContext save:&error] == NO) { [ErrorHandler handleError:error fatal:NO]; } Let’s set up the scaffolding for the internal error-handling framework. Start by creating a new single view application project. In this new project, create a new class file that subclasses NSObject. Give the new class the name “ErrorHandler.” Open ErrorHandler.h and add the declaration shown in Listing 1-9. Listing 1-9. Adding a declaration for the handleErrors: fatal: class method // // ErrorHandler.h // Default Error Handling // #import @interface ErrorHandler : NSObject +(void)handleError:(NSError *)error fatal:(BOOL)fatalError; @end ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.