Written in the previous words:
1, from now, this moment, began to work hard, move up!
2, "Effective OBJECTIVE-C 2.0" This is a very real book, each chapter with specific examples to inform readers of such reasons!
3, the book has been bought for a long time, but also go out to see, this is in accordance with the book chapters, summed up the contents of the book and their own experience!
4, willing to share the same!
47th: Familiar with the system framework
47.1: Many system frameworks can be used directly. The most important of these is foundation and corefoundation, which provide many of the core capabilities needed to build an application.
47.2: Many common tasks can be done with framework, such as audio and video processing, network communication, data management and so on.
47.3: Remember: The framework written in pure C is just as important as objective-c, and if you want to be a good objective-c developer, you should master the core concepts of C language.
48th: Multi-use block enumeration, less use for loop
48.1: There are four ways of traversing collection. The most basic method is the For loop, followed by the Nsenumerator traversal method and the fast calendar, the latest and most advanced Way is the "block enumeration method";
48.2: "Block enumeration" itself is able to perform traversal operations concurrently through GCD, without having to write code separately. This is not easily achieved with other traversal methods.
48.3: If you know in advance what kind of object the collection to traverse, you should modify the block signature to indicate the specific type of the object.
49th: Use seamless bridging for collection that customize its memory management semantics
49.1: Through the seamless bridging technology, the Objectiove-c object in the foundation framework can be converted back and forth between the C language data structure in the corefoundation framework;
49.2: When creating collection at the corefoundation level, you can specify a number of callback functions that represent how this collection should handle other elements. The seamless bridging technology can then be used to transform it into a Objective-c collection with special memory management semantics.
50th: Use Nscache instead of nsdictionary when building cache
50.1: Use Nscache instead of Nsdoictionary object when implementing cache. The Nscache can provide an elegant automatic deletion function, and is "thread-safe", in addition, it is different from the dictionary and does not copy the key.
50.2: You can set an upper limit on the Nscache object to limit the total number of objects in the cache and the "Total Cost", which defines the timing of the cache's deletion of objects. But never take these dimensions as a reliable "hard limit", which only directs Nscache.
50.3: Using Nspurgeabledata with Nscache, you can automate the ability to erase data, which means that the object itself is removed from the cache when the memory of the Nspurgeabledata object is discarded by the system.
50.4: If the cache is used properly, the response speed of the application can be improved. Only the "Sprint computing" data that seems to be cumbersome is worth the cache, such as those that need to be fetched from the network or read from disk.
51st: Streamlining the implementation code for initialize and load
51.1: In the load phase, if the class implements the Load method, the system calls it. This method can also be defined in the classification, and the load method of the class is more than the current invocation in the classification. Unlike other methods, the Load method does not participate in the overwrite mechanism.
51.2: The system sends a initialize message to a class before it is first used. Since this method conforms to the normal overwrite rules, it is often expected to determine which class is currently initialized.
Both the 51.3:load and initialize methods should be streamlined to help keep the application responsive and reduce the chance of introducing a "dependency ring" (interdependency cycle).
51.4: Global constants that cannot be set at compile time can be initialized in the Initialize method.
52nd: Don't forget Nstimer will keep its target object
The 52.1:nstimer object retains its target until the timer itself fails, the call to the Invalidate method invalidates the timer, and the one-time timer expires after the task is triggered.
52.2: the timer (repeating timer) that executes the task repeatedly is easy to introduce a retention ring, and if the target object of the timer retains the timer itself, it will certainly result in retention. This ring-preserving relationship may occur directly or through introduction of other objects in the object graph.
52.3: Can expand the function of Nstimer, use "block" to break the retention ring. However, unless Nstimer will provide this functionality in a public interface in the future, you must create a taxonomy to add the relevant code to it.
This chapter is mainly "effective objective-c" The seventh chapter of the content System framework! This chapter is also the end chapter of this book. The final two summary of the impostors suspicion, October will open the book Chapter remodeling Summary!
Write at the end of the words: every day to try a little bit, perhaps not obvious, but eventually will help!
October began, 2018 less than 100 days, work hard!
"Effective OBJECTIVE-C 2.0" after reading summary of the Five