Skip to content
CodeWorth
CodeWorth

Code worths when shared

Primary Navigation Menu
Menu
  • BLOG
    • DataBase
    • Programming
    • Mobile
    • Multimedia
    • OS Tips
    • Others
    • Web Development
  • Products
    • Utilities
    • Games
    • JsGenLib
      • PlugIns
      • Core Functions
      • Helper & ShortHands
  • About

iOS Interview Questions

On September 8, 2019
In Mobile
Tagged ios, ipad, iphone
With 0 Comments
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.
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 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.
Is the delegate for a CAAnimation retained?
Yes it is, It is rare exception from memory management rules. For the same reason we have to avoid delegating CAAnimation to other CAAnimation so it won’t cause retain cycle.

Follow link or link to know more about it.
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.

Pages: 1 2 3 4 5 6 7 8

2019-09-08

Subscribe

Enter your email address to receive notifications about new posts via email.

Join 634 other subscribers

Google

Designed using Chromatic WordPress Theme. Powered by WordPress.