1. Compare dynamic-typed vs static-typed languages. Discuss the advantages and disadvantages?
    • Statically-typed language:
    • Dynamic-typed language: why we call it Dynamic? because it is processed in Runtime !
  2. Compare objective-C with other languages. Discuss the advantages and disadvantages?
    • While objective-C looks similar to other languages like C/Java, it is fundamentally different in 2 aspects: it’s a dynamically typed language, and it uses methods and messages instead of function.
    • A dynamically typed language allows posing, so allows us to add new behaviours to existing framework classes.
  3. Life cycle & states of an application:
    1. 5 states: not running -> inactive -> active -> background (about 5s) -> suspended (not executing)
    2. (not-running)-touch icon-app:WillFinishLaunching-(->Inactive)-app:didFinishLaunching-appDidBecomeActive-(->Active)-appWillResignActive-(->Background)-appDidEnterBackground(5 seconds to perform tasks)(->Suspended)
    3. From background it can appWillEnterForeground-(->Active) or appWillTerminate(5 seconds to perform)(->not-running)
  4. Compare MRR with ARC?
    • Manual Retain Release:
      • creation with alloc_init, new or copy/mutableCopy (retainC =1)
      • retain (retainC+1), release (retainC-1), when retainC ==0 -> destroyed.
      • your class owns an obj if you created it or retained it.
      • Use release rather than Auto-release: release allows you to dictate the memory management (use autorelease if function returns an object created inside it).
      • dealloc is to release instance variables, also in viewDidUnload
      • use Macro RELEASE_SAFELY(obj) [object release];object=nil;
  5. Compare properties and ivars. When and why should we use ivars?
  6. Compare categories with subclasses? When and why should we use which?
  7. Common performance issues of TableView? CollectionView? How to avoid them?
  8. Three ways to achieve Concurrency in iOS? 
    • NSThread
    • NSOperationQueue
    • GCD
  9. Compare Objective-C and Swift? How to use Swift together in a project with Objective-C?
  10. What is the difference between Message-sending in Obj-C and function-calling in Java?
    • Message-sending in Obj-C is not like function calling. Message is just a request to call a function – the message is essentially a selector. Which function will be called is decided by the Message-receiving-object.
    • These 4 ways to send messages are equivalent:
      SEL mySelector = @selector(doSomething);
      [myObject doSomething]
      [myObject performSelector:mySelector]
      [myObject performSelector:@selector(doSomething)]
      [myObject performSelector:NSSelectorFromString(@"doSomething")];
    • If a message is forwarded to an object that can’t handle it, ERROR will be thrown.
    • If a message is forwarded to an object that does not respond to it, however, before announcing ERROR, the runtime sends it a forwardInvocation: message, so the message can be forwarded further.
    • However, class has opportunity to use dynamic method solver before the forwarding mechanism kicks in! If we implement these solvers (for instance/ class methods respectively):
      + (BOOL)resolveInstanceMethod:(SEL)aSEL

      or

      + (BOOL)resolveClassMethod:(SEL)aSEL

Try some questions

Glossary:

  1. _cmd: the enclosing method in which the current method is called.
  2. __func__: the function name string, also can use macros:
         __FUNCTION__ = sub
         __PRETTY_FUNCTION__ = void a::sub(int)
  3. IMP: instance method pointer – a function pointer – points to an Obj-C method.IMP is defined by:
    typedef id (*IMP)(id self,SEL _cmd,...);

    To access the IMP, the message “methodForSelector” can be used.

    IMP myImpDoSomething = [myObject methodForSelector:@selector(doSomething)];
  4. instancetype, unlike id, can only be used as the result type in a method declaration.

    With instancetype, the compiler will correctly infer that the result of +personWithName: is an instance of a Person.

  1. Apple Objective-C guides

    1. Defining Classes
    2. Working with Objects
    3. Encapsulating Data
    4. Customising Existing Classes
    5. Working with Protocols
    6. Values and Collections
    7. Working with Blocks
    8. Dealing with Errors
    9. Convention
  2. Basic questions

    1. messaging,
    2. protocols,
    3. dynamic types,
    4. forwarding,
    5. categories,
    6. posing,
    7. method swizzling
  3. Compare questions and more

    1. Memory management: copy vs retain, ARC vs MRR
    2. Code signing
    3. Debugging: compare
    4. Instruments: list
    5. Compare Collections
    6. GUI – frames vs bounds,
    7. App States:
    8. Compare Categories vs Subclasses
    9. Delegates vs notifications
  4. Do some questions:

    1. Top-tal guide
    2. Top-tal elite
Advertisements