CoreFoundation is a general-purpose C framework whereas Foundation is a general-purpose Objective-C frame. Both offer group classes, run loops, and so on, and many of the Foundation courses are wrappers around the CF equivalents. CF is chiefly open minded, and Foundation is closed-source.
Core Foundation is the C-level API, which provides CFString, CFDictionary and so on. Foundation is Objective-C, that provides NSString, NSDictionary, etc.. CoreFoundation is written in C while Foundation is composed in Objective-C. Foundation has a lot more courses CoreFoundation is the common foundation of Foundation and Carbon.
[both will store user generated files that may be exposed to consumer. Ex. email attachments]
~/Library [files not to user.]
~/tmp [System clears files if program not running.
Operations may be configured to conduct a block of code synchronously or asynchronously. Set them in functioning queue (NSOperationQueue) to avail concurrency.
Cocoa provides three Different Kinds of operations:
Block surgeries: These facilitate the implementation of one or more block items.
Invocation operations:These permit you to invoke a method in another, currently existing object.
Plain operations:These are plain functioning classes that have to be subclassed. The code to be executed will be written inside the primary method of this operation object.
Grand Central Dispatch isn't just a new abstraction about that which we've already been using, it is an whole new underlying mechanism which makes multithreading simpler and makes it easy to become concurrent as the code can be without fretting about the variables just like how much work your CPU cores are doing, the number of CPU cores you have and how much threads you should spawn in response.
Cocoa Manual Performance direction principles
To increment the keep count of any object, send it the keep message. This is called retaining the item. The object is now sure to persist at least until its keep count is decremented once again. To make this a little more suitable, a keep telephone returns as its value the preserved thing -- which is, [myObject keep ] returns the object pointed to by myObject, but with its keep count incremented.
When you state alloc (or fresh ) to a course, the subsequent instance comes into the world with its keep count incremented. You don't need to retain an item you've just instantiated by stating alloc or new (and you should not). Similarly, when you state copy to an case, the resultant new object (the copy) comes to the world with its retain count already incremented. You don't need to retain an item you have simply instantiated by saying replicate (and you shouldn't ).
To decrement the retain count of any object, send it that the release message. This is known as releasing the item.
If Object A got Object B by saying alloc (or fresh ) or copy, or if Object A has said keep to Object B, subsequently Object A should balance this finally by stating release to Object B, then after. Object A should assume thereafter that Object B no longer exists.
The frame of a opinion is that the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it's contained inside.
Class names should be unique across an entire program. Use 2 letter prefix linked to business name or program name or special element. If multiple words needed, then Camel example letter is preferred to use.
Method name should be expressive and distinctive within a class. It don't have prefix, and it must start in the lowercase letter; camel case for multiple words.
Local variable has to be unique within the same scope.
GCD:Straightforward, light weight, Low level C based API focused on lock free algorithms and functionality.
NSOperationQueue: Internally implemented with GCD. Recommended to use NSOperationQueue rather than GCD unless certain it does not support.
Why Objective -- C is a dynamic programming language ?
Static typed languages are those in which type checking is done at compile-time, whereas dynamic typed languages are those in which type checking is performed at run-time.
--- in other words --
Objective-C is a dynamically-typed terminology, meaning you don't have to tell the compiler what type of object you're working with at compile time. Declaring a type for a variable is merely a promise which can be broken at runtime if the code leaves space for anything. You can declare your variables as type id, which is suitable for any Objective-C object.
Software 2 frameworks:
"Cocoa" (OS X) = Foundation framework + Appkit
"Cocoa Touch" (iOS) = Foundation framework + UIKit [In iOS, Appkit replaced with UIKit]
Cocoa Touch: Responsible for View Controllers, Story board, Gestures and event finishing.
Includes following frameworks - UIKit, Map, Drive telling support, Message UI, Game Kit, iAd.
Core OS: Low degree Networking, External Accessories, memory allocation, threading, standard I/O. File system, A MAC 4XBSD unix kernel with C API.
Not operating State: The app has not yet been established or was running but has been terminated by the system.
Inactive condition: (Foreground) The app is running in the foreground but is currently not getting occasions. ( It could be executing other code however.) An app usually stays within this condition only briefly as it transitions into another state. The only time that it stays inactive for any time period is when the user locks the display or the system prompts the consumer to react to some event, such as an incoming telephone call or SMS message.
Active state (Foreground): The program is running in the foreground and is getting events. This is the normal mode for foreground apps.
Background state: The app is in the background along with implementing code. Most apps enter this state briefly on their way to being suspended. But, an program that asks extra execution time may stay in this condition for a time period. Additionally, an app being launched directly into the desktop enters this condition rather than the inactive state.
Suspended condition: The program is in the background but isn't executing code. The machine moves apps for this state automatically and does not notify them before doing this. While frozen, an program remains in memory but does not execute any code. When a low memory condition occurs, the system could purge suspended apps without notice to make more space to the foreground program.
Program Life/Launch Cycle
Program entry point"main" function, Creates application amount Autorelease pool.
Hands control off to UIKit framework by calling UIApplicationMain.
[b] UIApplicationMain invokes UIApplication, loads storyboard, reads info.plist for application setups. Sets UIApplicationDelegate, which will create UIWindow object and RootViewController.
[c] Main event loop: At launch time that later processes user event like gestures, sensor readings, redraw.
[d] Background Message: The executes code in desktop but not obtained any occasions. But, mostly it'll be on the manner of suspended state.
[e] Termination of app: System starts app termination when it misbehaves, not reacting events, out of memory.
#import contains some logic that will be certain that the file comprised only once. Avoids recursive addition. Where it not in the case of #include.
#import is an improved variant of #include.
#import brings the entire header file to the current file.
NSOperationQueue vs GCD
GCD:Simple, light weight, very low grade C based API centered on lock free algorithms and performance.
NSOperationQueue: Internally implemented using GCD.
Recommended to use NSOperationQueue rather than GCD unless certain it does not support. Because, - It can be pause, restart or cancel operations
KVO capabilities upon NSOperation class possessions.
Dependencies to execute operations in specific order.
Specific number of surgeries could be queued.
Exceptions represent programmer-level bugs such as attempting to get an array element that does not exist. They're made to notify the programmer that an unexpected illness occurred. Because they usually bring about the program crashing, exceptions should rarely occur on your production code.