Are Ready for Swift Programming Langauge
The Coding Tips
This blog is all about Technologies programming coding and new languages Learning materials,
Monday, September 5, 2016
Tuesday, May 10, 2016
iOS application interview Question and Answers For Basic's
Question 1
On a UITableViewCell constructor:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
What is the
reuseIdentifier
used for?
The
reuseIdentifier
is used to indicate that a cell can be re-used in a UITableView
. For example when the cell looks the same, but has different content. The UITableView
will maintain an internal cache of UITableViewCell
’s with the reuseIdentifier
and allow them to be re-used whendequeueReusableCellWithIdentifier:
is called. By re-using table cell’s the scroll performance of the tableview is better because new views do not need to be created.Question 2
Explain the difference between atomic and nonatomic synthesized properties?
Atomic and non-atomic refers to whether the setters/getters for a property will atomically read and write values to the property. When the atomic keyword is used on a property, any access to it will be “synchronized”. Therefore a call to the getter will be guaranteed to return a valid value, however this does come with a small performance penalty. Hence in some situations nonatomic is used to provide faster access to a property, but there is a chance of a race condition causing the property to be nil under rare circumstances (when a value is being set from another thread and the old value was released from memory but the new value hasn’t yet been fully assigned to the location in memory for the property).
Question 3
Explain the difference between copy and retain?
Retaining an object means the retain count increases by one. This means the instance of the object will be kept in memory until it’s retain count drops to zero. The property will store a reference to this instance and will share the same instance with anyone else who retained it too. Copy means the object will be cloned with duplicate values. It is not shared with any one else.
Question 4
What is method swizzling in Objective C and why would you use it?
Method swizzling allows the implementation of an existing selector to be switched at runtime for a different implementation in a classes dispatch table. Swizzling allows you to write code that can be executed before and/or after the original method. For example perhaps to track the time method execution took, or to insert log statements
#import "UIViewController+Log.h"
@implementation UIViewController (Log)
+ (void)load {
static dispatch_once_t once_token;
dispatch_once(&once_token, ^{
SEL viewWillAppearSelector = @selector(viewDidAppear:);
SEL viewWillAppearLoggerSelector = @selector(log_viewDidAppear:);
Method originalMethod = class_getInstanceMethod(self, viewWillAppearSelector);
Method extendedMethod = class_getInstanceMethod(self, viewWillAppearLoggerSelector);
method_exchangeImplementations(originalMethod, extendedMethod);
});
}
- (void) log_viewDidAppear:(BOOL)animated {
[self log_viewDidAppear:animated];
NSLog(@"viewDidAppear executed for %@", [self class]);
}
@end
Question 5
What’s the difference between not-running, inactive, active, background and suspended execution states?
- Not running: The app has not been launched or was running but was terminated by the system.
- Inactive: The app is running in the foreground but is currently not receiving events. (It may be executing other code though.) An app usually stays in this state only briefly as it transitions to a different state.
- Active: The app is running in the foreground and is receiving events. This is the normal mode for foreground apps.
- Background: The app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time may remain in this state for a period of time. In addition, an app being launched directly into the background enters this state instead of the inactive state.
- Suspended: The app is in the background but is not executing code. The system moves apps to this state automatically and does not notify them before doing so. While suspended, an app remains in memory but does not execute any code. When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.
Question 6
What is a category and when is it used?
A category is a way of adding additional methods to a class without extending it. It is often used to add a collection of related methods. A common use case is to add additional methods to built in classes in the Cocoa frameworks. For example adding async download methods to the
UIImage
class.Question 7
Can you spot the bug in the following code and suggest how to fix it:
@interface MyCustomController : UIViewController
@property (strong, nonatomic) UILabel *alert;
@end
@implementation MyCustomController
- (void)viewDidLoad {
CGRect frame = CGRectMake(100, 100, 100, 50);
self.alert = [[UILabel alloc] initWithFrame:frame];
self.alert.text = @"Please wait...";
[self.view addSubview:self.alert];
dispatch_async(
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
sleep(10);
self.alert.text = @"Waiting over";
}
);
}
@end
All UI updates must be done on the main thread. In the code above the update to the alert text may or may not happen on the main thread, since the global dispatch queue makes no guarantees . Therefore the code should be modified to always run the UI update on the main thread
dispatch_async(
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
sleep(10);
dispatch_async(dispatch_get_main_queue(), ^{
self.alert.text = @"Waiting over";
});
});
Question 8
What is the difference between
viewDidLoad
and viewDidAppear
? Which should you use to load data from a remote server to display in the view?viewDidLoad
is called when the view is loaded, whether from a Xib file, storyboard or programmatically created in loadView
. viewDidAppear
is called every time the view is presented on the device. Which to use depends on the use case for your data. If the data is fairly static and not likely to change then it can be loaded in viewDidLoad
and cached. However if the data changes regularly then using viewDidAppear
to load it is better. In both situations, the data should be loaded asynchronously on a background thread to avoid blocking the UI.Question 9
What considerations do you need when writing a
UITableViewController
which shows images downloaded from a remote server?
This is a very common task in iOS and a good answer here can cover a whole host of knowledge. The important piece of information in the question is that the images are hosted remotely and they may take time to download, therefore when it asks for “considerations”, you should be talking about:
- Only download the image when the cell is scrolled into view, i.e. when
cellForRowAtIndexPath
is called. - Downloading the image asynchronously on a background thread so as not to block the UI so the user can keep scrolling.
- When the image has downloaded for a cell we need to check if that cell is still in the view or whether it has been re-used by another piece of data. If it’s been re-used then we should discard the image, otherwise we need to switch back to the main thread to change the image on the cell.
Other good answers will go on to talk about offline caching of the images, using placeholder images while the images are being downloaded.
Question 10
What is a protocol, how do you define your own and when is it used?
A protocol is similar to an interface from Java. It defines a list of required and optional methods that a class must/can implement if it adopts the protocol. Any class can implement a protocol and other classes can then send messages to that class based on the protocol methods without it knowing the type of the class.
@protocol MyCustomDataSource
- (NSUInteger)numberOfRecords;
- (NSDictionary *)recordAtIndex:(NSUInteger)index;
@optional
- (NSString *)titleForRecordAtIndex:(NSUInteger)index;
@end
A common use case is providing a DataSource for
UITableView
or UICollectionView
.Question 11
What is KVC and KVO? Give an example of using KVC to set a value.
KVC stands for Key-Value Coding. It's a mechanism by which an object's properties can be accessed using string's at runtime rather than having to statically know the property names at development time. KVO stands for Key-Value Observing and allows a controller or class to observe changes to a property value.
Let's say there is a property
name
on a class:@property (nonatomic, copy) NSString *name;
We can access it using KVC:
NSString *n = [object valueForKey:@"name"]
And we can modify it's value by sending it the message:
[object setValue:@"Mary" forKey:@"name"]
Question 12
What are blocks and how are they used?
Blocks are a way of defining a single task or unit of behavior without having to write an entire Objective-C class. Under the covers Blocks are still Objective C objects. They are a language level feature that allow programming techniques like lambdas and closures to be supported in Objective-C. Creating a block is done using the
^ { }
syntax: myBlock = ^{
NSLog(@"This is a block");
}
It can be invoked like so:
myBlock();
It is essentially a function pointer which also has a signature that can be used to enforce type safety at compile and runtime. For example you can pass a block with a specific signature to a method like so:
- (void)callMyBlock:(void (^)(void))callbackBlock;
If you wanted the block to be given some data you can change the signature to include them:
- (void)callMyBlock:(void (^)(double, double))block {
...
block(3.0, 2.0);
}
Question 13
What mechanisms does iOS provide to support multi-threading?
NSThread
creates a new low-level thread which can be started by calling thestart
method.
NSThread* myThread = [[NSThread alloc] initWithTarget:self
selector:@selector(myThreadMainMethod:)
object:nil];
[myThread start];
NSOperationQueue
allows a pool of threads to be created and used to executeNSOperation
s in parallel.NSOperation
s can also be run on the main thread by askingNSOperationQueue
for themainQueue
.
NSOperationQueue* myQueue = [[NSOperationQueue alloc] init];
[myQueue addOperation:anOperation];
[myQueue addOperationWithBlock:^{
/* Do something. */
}];
- GCD or Grand Central Dispatch is a modern feature of Objective-C that provides a rich set of methods and API's to use in order to support common multi-threading tasks. GCD provides a way to queue tasks for dispatch on either the main thread, a concurrent queue (tasks are run in parallel) or a serial queue (tasks are run in FIFO order).
dispatch_queue_t myQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(myQueue, ^{
printf("Do some work here.\n");
});
Question 14
What is the Responder Chain?
When an event happens in a view, for example a touch event, the view will fire the event to a chain of
UIResponder
objects associated with the UIView
. The first UIResponder
is the UIView
itself, if it does not handle the event then it continues up the chain to until UIResponder
handles the event. The chain will include UIViewController
s, parent UIView
s and their associatedUIViewController
s, if none of those handle the event then the UIWindow
is asked if it can handle it and finally if that doesn't handle the event then the UIApplicationDelegate
is asked.
If you get the opportunity to draw this one out, it's worth doing to impress the interviewer:
Question 15
What's the difference between using a delegate and notification?
Both are used for sending values and messages to interested parties. A delegate is for one-to-one communication and is a pattern promoted by Apple. In delegation the class raising events will have a property for the delegate and will typically expect it to implement some
protocol
. The delegating class can then call the delegates protocol methods.
Notification allows a class to broadcast events across the entire application to any interested parties. The broadcasting class doesn't need to know anything about the listeners for this event, therefore notification is very useful in helping to decouple components in an application.
[NSNotificationCenter defaultCenter]
postNotificationName:@"TestNotification"
object:self];
Question 16
What's your preference when writing UI's? Xib files, Storyboards or programmatic
UIView
?
There's no right or wrong answer to this, but it's great way of seeing if you understand the benefits and challenges with each approach. Here's the common answers I hear:
- Storyboard's and Xib's are great for quickly producing UI's that match a design spec. They are also really easy for product managers to visually see how far along a screen is.
- Storyboard's are also great at representing a flow through an application and allowing a high-level visualization of an entire application.
- Storyboard's drawbacks are that in a team environment they are difficult to work on collaboratively because they're a single file and merge's become difficult to manage.
- Storyboards and Xib files can also suffer from duplication and become difficult to update. For example if all button's need to look identical and suddenly need a color change, then it can be a long/difficult process to do this across storyboards and xibs.
- Programmatically constructing
UIView
's can be verbose and tedious, but it can allow for greater control and also easier separation and sharing of code. They can also be more easily unit tested.
Most developers will propose a combination of all 3 where it makes sense to share code, then re-usable
UIView
s or Xib
files.Question 17
How would you securely store private user data offline on a device? What other security best practices should be taken?
Again there is no right answer to this, but it's a great way to see how much a person has dug into iOS security. If you're interviewing with a bank I'd almost definitely expect someone to know something about it, but all companies need to take security seriously, so here's the ideal list of topics I'd expect to hear in an answer:
- If the data is extremely sensitive then it should never be stored offline on the device because all devices are crackable.
- The keychain is one option for storing data securely. However it's encryption is based on the pin code of the device. User's are not forced to set a pin, so in some situations the data may not even be encrypted. In addition the users pin code may be easily hacked.
- A better solution is to use something like SQLCipher which is a fully encrypted SQLite database. The encryption key can be enforced by the application and separate from the user's pin code.
Other security best practices are:
- Only communicate with remote servers over SSL/HTTPS.
- If possible implement certificate pinning in the application to prevent man-in-the-middle attacks on public WiFi.
- Clear sensitive data out of memory by overwriting it.
- Ensure all validation of data being submitted is also run on the server side.
Question 18
What is MVC? How is it implemented in iOS? What are some pitfalls you've experienced with it? Are there any alternatives to MVC?
MVC stands for Model, View, Controller. It is a design pattern that defines how to separate out logic when implementing user interfaces. In iOS, Apple provides
UIView
as a base class for allViews, UIViewController
is provided to support the Controller which can listen to events in aView and update the View when data changes. The Model represents data in an application and can be implemented using any NSObject
, including data collections like NSArray
andNSDictionary
.
Some of the pitfalls that people hit are bloated
UIViewController
and not separating out code into classes beyond the MVC format. I'd highly recommend reading up on some solutions to this:- https://www.objc.io/issues/1-view-controllers/lighter-view-controllers/
- https://speakerdeck.com/trianglecocoa/unburdened-viewcontrollers-by-jay-thrash
- https://programmers.stackexchange.com/questions/177668/how-to-avoid-big-and-clumsy-uitableviewcontroller-on-ios
In terms of alternatives, this is pretty open ended. The most common alternative is MVVM using ReactiveCocoa, but others include VIPER and using Functional Reactive code.
Question 19
A product manager in your company reports that the application is crashing. What do you do?
This is a great question in any programming language and is really designed to see how you problem solve. You're not given much information, but some interviews will slip you more details of the issue as you go along. Start simple:
- get the exact steps to reproduce it.
- find out the device, iOS version.
- do they have the latest version?
- get device logs if possible.
Once you can reproduce it or have more information then start using tooling. Let's say it crashes because of a memory leak, I'd expect to see someone suggest using Instruments leak tool. A really impressive candidate would start talking about writing a unit test that reproduces the issue and debugging through it.
Other variations of this question include slow UI or the application freezing. Again the idea is to see how you problem solve, what tools do you know about that would help and do you know how to use them correctly.
Question 20
What is AutoLayout? What does it mean when a constraint is "broken" by iOS?
AutoLayout is way of laying out
UIView
s using a set of constraints that specify the location and size based relative to other views or based on explicit values. AutoLayout makes it easier to design screens that resize and layout out their components better based on the size and orientation of a screen. Constraints include:- setting the horizontal/vertical distance between 2 views
- setting the height/width to be a ratio relative to a different view
- a width/height/spacing can be an explicit static value
Sometimes constraints conflict with each other. For example imagine a
UIView
which has 2 height constraints: one says make the UIView
200px high, and the second says make the height twice the height of a button. If the iOS runtime can not satisfy both of these constraints then it has to pick only one. The other is then reported as being "broken" by iOS.
Another interview Question Answer's
1.What is latest iOS version?
IOS - 6.1.3 (updated on 5/15/13 3:15 AM
Pacific Daylight Time)
Pacific Daylight Time)
2.What is latest Xcode version?
Xcode- 4.6.2 (updated on 5/15/13 3:15 AM
Pacific Daylight Time)
3.What is latest mac os version?
Mac- Mountain Lion (updated on 5/15/13 3:15 AM
Pacific Daylight Time)
4.What is iPad screen size?
1024X768
5.what is iPhone screen size?
320X480
6.What are the features is IOS 6?
1.Map :beautifully designed from the ground up (and the sky down)
2.Integration of Facebook with iOS
3.shared photo streams.
4.Passbook - boarding passes, loyalty cards, retail coupons, cinema tickets and more all in one place
5.Facetime - on mobile network as wifi
6.changed Phone app - *remind me later,*reply with message.
7.Mail - redesigned more streamline interface.
8.Camera with panorama .
7.Who invented Objective c?
Broad cox and Tom Love
8.What is Cococa and cocoa touch?
Cocoa is for Mac App development and cocoa touch is for apples touch devices - that provide all development environment
9.What is Objective c?
*Objective-C is a reflective, object-oriented programming language which adds Smalltalk-style messaging to the C programming language. strictly superset of c.
10. how declare methods in Objective c? and how to call them?
- (return_type)methodName:(data_type)parameter_name : (data_type)parameter_name
11. What is property in Objective c?
Property allow declared variables with specification like atomic/nonatmic, or retain/assign
12.What is meaning of "copy" keyword?
copy object during assignment and increases retain count by 1
13.What is meaning of "readOnly" keyword?
Declare read only object / declare only getter method
14.What is meaning of "retain" keyword?
Specifies that retain should be invoked on the object upon assignment. takes ownership of an object
15.What is meaning of "assign" keyword?
Specifies that the setter uses simple assignment. Uses on attribute of scalar type like float,int.
16.What is meaning of "atomic" keyword?
"atomic", the synthesized setter/getter will ensure that a whole value is always returned from the getter or set by the setter, only single thread can access variable to get or set value at a time
17.What is meaning of "nonatomic" keyword?
In non atomic no such guaranty that value is returned from variable is same that setter sets. at same time
18.What is difference between "assign" and "retain" keyword?
Retain -Specifies that retain should be invoked on the object upon assignment. takes ownership of an object
Assign - Specifies that the setter uses simple assignment. Uses on attribute of scalar type like float,int.
19.What is meaning of "synthesize" keyword ?
ask the compiler to generate the setter and getter methods according to the specification in the declaration
20.What is "Protocol" on objective c?
A protocol declares methods that can be implemented by any class. Protocols are not classes themselves. They simply define an interface that other objects are responsible for implementing. Protocols have many advantages. The idea is to provide a way for classes to share the same method and property declarations without inheriting them from a common ancestor
21.What is use of UIApplication class?
The UIApplication class implements the required behavior of an application.
22.What compilers apple using ?
The Apple compilers are based on the compilers of the GNU Compiler Collection.
23.What is synchronized() block in objective c? what is the use of that?
The @synchronized()directive locks a section of code for use by a single thread. Other threads are blocked until the thread exits the protected code.
24. What is the "interface" and "implementation"?
interface declares the behavior of class and implementation defines the behavior of class.
25.What is "private", "Protected" and "Public" ?
private - limits the scope class variable to the class that declares it.
protected - Limits instance variable scope to declaring and inheriting classes.
public - Removes restrictions on the scope of instance variables
26. What is the use of "dynamic" keyword?
Instructs the compiler not to generate a warning if it cannot find implementations of accessor methods associated with the properties whose names follow.
27.What is "Delegate" ?
A delegate is an object that will respond to pre-chosen selectors (function calls) at some point in the future., need to implement the protocol method by the delegate object.
28.What is "notification"?
provides a mechanism for broadcasting information within a program, using notification we can send message to other object by adding observer .
29.What is difference between "protocol" and "delegate"?
protocol is used the declare a set of methods that a class that "adopts" (declares that it will use this protocol) will implement.
Delegates are a use of the language feature of protocols. The delegation design pattern is a way of designing your code to use protocols where necessary.
30.What is "Push Notification"?
to get the any update /alert from server .
31.How to deal with SQLite database?
Dealing with sqlite database in iOS:
1. Create database : sqlite3 AnimalDatabase.sql
2.Create table and insert data in to table :
CREATE TABLE animals ( id INTEGER PRIMARY KEY, name VARCHAR(50), description TEXT, image VARCHAR(255) );
INSERT INTO animals (name, description, image) VALUES ('Elephant', 'The elephant is a very large animal that lives in Africa and Asia', 'http://dblog.com.au/wp-content/elephant.jpg');
3. Create new app --> Add SQLite framework and database file to project
4. Read the database and close it once work done with database :
// Setup the database object
sqlite3 *database;
// Init the animals Array
animals = [[NSMutableArray alloc] init];
// Open the database from the users filessytem
if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
// Setup the SQL Statement and compile it for faster access
const char *sqlStatement = "select * from animals";
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
// Loop through the results and add them to the feeds array
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
// Read the data from the result row
NSString *aName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
NSString *aDescription = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];
NSString *aImageUrl = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];
// Create a new animal object with the data from the database
Animal *animal = [[Animal alloc] initWithName:aName description:aDescription url:aImageUrl];
// Add the animal object to the animals Array
[animals addObject:animal];
[animal release];
}
}
// Release the compiled statement from memory
sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);
32.What is storyboard?
With Storyboards, all screens are stored in a single file. This gives you a conceptual overview of the visual representation for the app and shows you how the screens are connected. Xcode provides a built-in editor to layout the Storyboards.
- .storyboard is essentially one single file for all your screens in the app and it shows the flow of the screens. You can add segues/transitions between screens, this way. So, this minimizes the boilerplate code required to manage multiple screens.
- 2. Minimizes the overall no. of files in an app.
33.What is Category in Objective c?
A category allows you to add methods to an existing class—even to one for which you do not have the source.
34.What is block in objective c?
Blocks are a language-level feature added to C, Objective-C and C++, which allow you to create distinct segments of code that can be passed around to methods or functions as if they were values. Blocks are Objective-C objects, which means they can be added to collections like NSArray or NSDictionary. They also have the ability to capture values from the enclosing scope, making them similar to closures or lambdas in other programming languages.
35. How to parse xml? explain in deep.
Using NSXMLParser.
Create xml parser object with xml data, set its delegate , and call the parse method with parserObject.
Delegate methods getting called :
36.How to parse JSON? explain in deep.
By using NSJSONSerialization.
For example : NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData: data options: NSJSONReadingMutableContainers error: &e];
37.How to use reusable cell in UITableview?
By using dequeReusableCellWithIdentifier
38.What is the meaning of "strong"keyword?
*strong -o "own" the object you are referencing with this property/variable. The compiler will take care that any object that you assign to this property will not be destroyed as long as you (or any other object) points to it with a strong reference.
39.What is the meaning of "weak" keyword?
*Weak - weak reference you signify that you don't want to have control over the object's lifetime. The object you are referencing weakly only lives on because at least one other object holds a strong reference to it. Once that is no longer the case, the object gets destroyed and your weak property will automatically get set to nil.
40.What is difference strong and weak reference ? explain.
complier with be responsible for lifetime of object which is declared as strong. for weak object - compiler will destroy object once strong reference that hold weak object get destroyed.
41.What is ARC ? How it works? explain in deep.
Automatic reference counting (ARC) If the compiler can recognize where you should be retaining and releasing objects, and put the retain and release statement in code.
42. What manual memory management ? how it work?
In Manual memory management developers is responsible for life cycle of object. developer has to retain /alloc and release the object wherever needed.
43. How to find the memory leaks in MRC?
By using -
1. Static analyzer.
2. Instrument
44.what is use of NSOperation? how NSOperationque works?
An operation object is a single-shot object—that is, it executes its task once and cannot be used to execute it again. You typically execute operations by adding them to an operation queueAn NSOperationQueue object is a queue that handles objects of the NSOperation class type. An NSOperation object, simply phrased, represents a single task, including both the data and the code related to the task. The NSOperationQueue handles and manages the execution of all the NSOperation objects (the tasks) that have been added to it.
45.How to send crash report from device?
46.What is autorealease pool?
Every time -autorelease is sent to an object, it is added to the inner-most autorelease pool. When the pool is drained, it simply sends -release to all the objects in the pool.
Autorelease pools are simply a convenience that allows you to defer sending -release until "later". That "later" can happen in several places, but the most common in Cocoa GUI apps is at the end of the current run loop cycle.
47.What happens when we invoke a method on a nil pointer?
48.Difference between nil and Nil.
Nil is meant for class pointers, and nil is meant for object pointers
49.What is fast enumeration?
for(id object in objets){
}
50. How to start a thread?
- (void)performSelectorInBackground:(SEL)aSelector withObject:(id)arg on NSObject
NSThread* evtThread = [ [NSThread alloc] initWithTarget:self
selector:@selector( saySomething )
object:nil ];
[ evtThread start ];
51.How to download something from the internet?
By Using NSURLConnection , by starting connection or sending synchronous request.
52.what is synchronous web request and asynchronous ?
In synchronous request main thread gets block and control will not get back to user till that request gets execute.
In Asynchronous control gets back to user even if request is getting execute.
53. Difference between sax parser and dom parser ?
SAX (Simple API for XML)
- Parses node by node
- Doesn't store the XML in memory
- We can not insert or delete a node
- Top to bottom traversing
DOM (Document Object Model)
- Stores the entire XML document into memory before processing
- Occupies more memory
- We can insert or delete nodes
- Traverse in any direction
54.Explain stack and heap?
55.What are the ViewController lifecycle in ios?
loadView - viewDidLoad-viewWillAppear-viewDidAppear - viewDisappear - viewDidUnload
56.Difference between coredata & sqlite?
There is a huge difference between these two. SQLLite is a database itself like we have MS SQL Server. But CoreData is an ORM (Object Relational Model) which creates a layer between the database and the UI. It speeds-up the process of interaction as we dont have to write queries, just work with the ORM and let ORM handles the backend. For save or retrieval of large data, I recommend to use Core Data because of its abilities to handle the less processing speed of IPhone.
57.Steps for using coredata?
NSFetchedResultsController - It is designed primarily to function as a data source for aUITableView
58.Procedure to push the app in AppStore?
59.What are the Application lifecycle in ios?
ApplicationDidFinishLaunchingWithOption -ApplicationWillResignActive- ApplicationDidBecomeActive-ApplicationWillTerminate
60.Difference between release and autorelease ?
release - destroy the object from memory,
autorelease - destroy the object from memory in future when it is not in use.
61.How to start a selector on a background thread
- (void)performSelectorInBackground:(SEL)aSelector withObject:(id)arg on NSObject
62.What happens if the methods doesn’t exist
App will crash with exception unrecognized selector sent to instance.
63. How Push notification works?
Server - Apple server - device by using APNs
Delegate methods :
UITableView:
DataSource -
Configuring a Table View
– tableView:cellForRowAtIndexPath: required method
– tableView:numberOfRowsInSection: required method
Inserting or Deleting Table Rows
Reordering Table Rows
Delegate -
Configuring Rows for the Table View
Managing Accessory Views
Managing Selections
Modifying the Header and Footer of Sections
Editing Table Rows
Reordering Table Rows
Copying and Pasting Row Content
UIPickerView-
DataSource -
Providing Counts for the Picker View
Delegate -
Setting the Dimensions of the Picker View
Setting the Content of Component Rows
The methods in this group are marked @optional. However, to use a picker view, you must implement either thepickerView:titleForRow:forComponent: or thepickerView:viewForRow:forComponent:reusingView: method to provide the content of component rows.
Responding to Row Selection
UITextFeild-
Delegate -
Managing Editing
Editing the Text Field’s Text
UItextView-
Delegate - Responding to Editing Notifications
Responding to Text Changes
Responding to Selection Changes
MKMapView-
Delegate -
Responding to Map Position Changes
Loading the Map Data
Tracking the User Location
– mapView:didChangeUserTrackingMode:animated: required method
Managing Annotation Views
Dragging an Annotation View
Selecting Annotation Views
Managing Overlay Views
NSURLConnection-
Delegate -
Connection Authentication
Connection Completion
NSURLConnectionDownloadDelegate
NSURLConnection
Preflighting a Request
Loading Data Synchronously
Loading Data Asynchronously
Stopping a Connection
Scheduling Delegate Messages
NSXMLParser-
Handling XML
Handling the DTD
7.NSURLConnection
Connection Authentication
- – connection:willSendRequestForAuthenticationChallenge:
- – connection:canAuthenticateAgainstProtectionSpace:
- – connection:didCancelAuthenticationChallenge:
- – connection:didReceiveAuthenticationChallenge:
- – connectionShouldUseCredentialStorage:
Connection Completion
- – connection:didFailWithError:
MethodGroup
- – connection:needNewBodyStream
- – connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite: required method
- – connection:didReceiveData: required method
- – connection:didReceiveResponse: required method
- – connection:willCacheResponse: required method
- – connection:willSendRequest:redirectResponse: required method
- – connectionDidFinishLoading: required method
Subscribe to:
Posts (Atom)
-
In case you are running early stage startup, it is expected that you know how to make the most of limited resources. It is important for ...
-
The development of the mobile industry is playing an important market - the ability to conceptualize, develop and play t...
-
Short Bytes: The Russian government is planning to replace all of its Windows-powered computers with some Linux distribution. The g...