Questions 35 to 41 in 50
Page 6
Is there any garbage collector available in iOS?
No garbage collection only available in OSX, But autorelease instances can be used to ensure they are cleared when the pool is drained.
We must do Manual Retain Counting to ensure objects created only when needed and cleared when no longer used. But Begining from Xcode 4.2 , ARC (Automatic Reference Counting) is introduced to avoid developers handling retain counting. This is still not as same as Garbage collection but an efficient way to code without worrying about memory cycles at coding time instead they can be taken care at instrumentation time.
We must do Manual Retain Counting to ensure objects created only when needed and cleared when no longer used. But Begining from Xcode 4.2 , ARC (Automatic Reference Counting) is introduced to avoid developers handling retain counting. This is still not as same as Garbage collection but an efficient way to code without worrying about memory cycles at coding time instead they can be taken care at instrumentation time.
Why do we need to use
@Synthesize
?
We can use generated code like nonatomic, atmoic, retain without writing any lines of code. We also have getter and setter methods.
To use this, we have 2 other ways: @synthesize or @dynamic.
In
Synthesize is avaible in implementation only but On interface
To use this, we have 2 other ways: @synthesize or @dynamic.
In
@synthesize
compiler will generate the getter and setter automatically for us whereas in
@dynamic
: we have to write them ourself.Synthesize is avaible in implementation only but On interface
@property
is really good for memory management for example: retain.
How do you retain without
@property
?
We could retain by declaring an interface level instance and implement in implementation as below
if (_variable != object) { [_variable release]; _variable = nil; _variable = [object retain]; }
What is sandbox?
For security reasons, iOS places each app (including its preferences and data) in a sandbox at install time. A sandbox is a set of fine-grained
controls that limit the app’s access to files, preferences, network resources, hardware, and so on. As part of the sandboxing process, the system
installs each app in its own sandbox directory, which acts as the home for the app and its data.
To help apps organize their data, each sandbox directory contains several well-known subdirectories for placing files. Below Figure shows the basic layout of a sandbox directory.
To help apps organize their data, each sandbox directory contains several well-known subdirectories for placing files. Below Figure shows the basic layout of a sandbox directory.
Is the delegate for a CAAnimation retained?
What are concurrent and non-concurrent queues in NSOperationQueue? How they primarily differ?
In the context of an NSOperation object, which runs in an NSOperationQueue, the terms concurrent and non-concurrent do not necessarily refer to the
side-by-side execution of threads. Instead, a non-concurrent operation is one that executes using the environment that is provided for it while a
concurrent operation is responsible for setting up its own execution environment.
What is Automatic Reference Counting (ARC) ? How it differs from MRC?
ARC is a compiler-level feature that simplifies the process of managing the lifetimes of Objective-C objects.
Instead of us having to remember when to retain or release an object, ARC evaluates the lifetime requirements of our objects and automatically adds up the
appropriate method calls at compile time.
It does not differ alot from MRC, it is similar to synthesizing properties where getters/setters are added up at compile time without us writing. Here in ARC it adds up MRC method calls at compile time without us specifying explicitly.
It does not differ alot from MRC, it is similar to synthesizing properties where getters/setters are added up at compile time without us writing. Here in ARC it adds up MRC method calls at compile time without us specifying explicitly.