Prev….(Part 2)
Q15. What is the way to store value as default in application without using nsuserdefault for the application run firts time, because first time there will be no any data in nsuserdefault.
A.
Through Plist.
Q16. What is the significant of passing (NSDictionary *)launchOptions in application didFinishLaunchingWithOptions ? What are the options in application didFinishLaunchingWithOptions ?
A.
Launching an application by tapping its icon, an application can be launched in order to respond to a specific type of event.
1. When application is not running, and user click on view button on the notification. To interpret this notification we have to implement application:didFinishLaunchingWithOptions: instead of applicationDidFinishLaunching: like this:
2. And when application is already in running state, in this case application delegate receives a call to application:didReceiveRemoteNotification:. This method also receives userInfo like this:
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
Q18. Difference between Cocoa and Cocoa touch ?
Q19. What is KVC and KVO ?
Q20. What architecture iOS follows ?
Q21. What are collection methods ?
Q22. How to handle NSLog before release ?
WILL BE CONTINUE… :
)
Q14. What are the ways to store data localy on device ?
A.
We store data localy in device through:
- Plist.
- NSUserDefaults.
- SQLite.
- CoreData.
Q15. What is the way to store value as default in application without using nsuserdefault for the application run firts time, because first time there will be no any data in nsuserdefault.
A.
Through Plist.
Q16. What is the significant of passing (NSDictionary *)launchOptions in application didFinishLaunchingWithOptions ? What are the options in application didFinishLaunchingWithOptions ?
A.
Launching an application by tapping its icon, an application can be launched in order to respond to a specific type of event.
For example, it could be launched in response to an incoming push notification, it could be asked to open a file, or it could be launched to handle some background event that it had requested. In all of these cases, the options dictionary passed to the
application:didFinishLaunchingWithOptions:
method provides information about the reason for the launch.
In situations where the application is already running, the methods of the application delegate are called in response to key changes.
There are 7 launch options key:
UIApplicationLaunchOptionsURLKey;
UIApplicationLaunchOptionsSourceApplicationKey;
UIApplicationLaunchOptionsRemoteNotificationKey;
UIApplicationLaunchOptionsAnnotationKey;
UIApplicationLaunchOptionsLocalNotificationKey;
UIApplicationLaunchOptionsLocationKey;
UIApplicationLaunchOptionsNewsstandDownloadsKey;
For example:
When you actually receive a notification, there are 2 way it can be handel in our application:1. When application is not running, and user click on view button on the notification. To interpret this notification we have to implement application:didFinishLaunchingWithOptions: instead of applicationDidFinishLaunching: like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSDictionary* userInfo = [launchOptions valueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
NSDictionary *payLoad= [userInfo objectForKey:@"aps"];
NSDictionary *alertMsg = [userInfo objectForKey:@"alert"];
NSDictionary * badgeCount = [userInfo objectForKey:@"badge"];
//....do something with this.
}
2. And when application is already in running state, in this case application delegate receives a call to application:didReceiveRemoteNotification:. This method also receives userInfo like this:
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSDictionary *payLoad= [userInfo objectForKey:@"aps"];
NSDictionary *alertMsg = [userInfo objectForKey:@"alert"];
NSDictionary * badgeCount = [userInfo objectForKey:@"badge"];
//....do something with this.
}
Q17. What are the design patterns in iOS ?
A.
Q18. Difference between Cocoa and Cocoa touch ?
A.
Q19. What is KVC and KVO ?
A.
Its a design pattern follow by iOS. Its a.......Q20. What architecture iOS follows ?
A.
Q21. What are collection methods ?
A.
For objects that manage a collection of objects (each called an element of that collection).
For example:
- (void)add
Element:(
elementType)
anObj;
- (void)remove
Element:(
elementType)
anObj;
- (NSArray *)
elements;
Q22. How to handle NSLog before release ?
A.
All The Best :)
)
there is a typo "application run 'firts' time"
ReplyDelete