iOS face question Six

Source: Internet
Author: User

1.Comparison ofblock and protocol .

BLOCK: inline function with anonymous functionality

1) Block can be passed as a function parameter

2) you can write directly in the code and wait for the program to be executed.


Protocol: A Protocol is the declaration of a method, and when a class complies with the agreement it is equivalent to having a declaration of all the methods in this agreement.



2. for statement nsstring* testobject = [[NSData alloc]init];testobject What types of objects are at compile time and run time respectively?

compile time is NSString , the runtime is NSData


3. OC How is the interaction between all the objects implemented?

Message mechanism


4. What is a sandbox ( Sandbox )? The sandbox contains the files that describe the usage scenarios for each file. How do I get the path to these files? How do I get the path to a file in an application package?

IOS in the sandbox mechanism ( SandBox ) is a security system that specifies that an application can only read files within a folder created for the app and cannot access content elsewhere. All non-code files are saved in this place, such as slices, sounds, attribute lists, and text files.

. App file: This is a running application file

Documents : Apple It is recommended that the file data created in the program or browsed in the program be saved in this directory, ITunes This directory is included in backup and recovery

Library : The default settings of the stored program or other status information;library/caches: Store cache files,iTunes does not back up this directory, Files in this directory are not deleted when the app exits

tmp: the location where temporary files are created and stored Party.

Get the Documents folder directory, the first parameter is the description get doucments folder directory, the second parameter description is obtained in the current application sandbox, all application sandbox directory composed of an array structure of data storage nsarray *docpath = Nssearchpathfordirectoriesindomains (Nsdocumentdirectory,nsuserdomainmask, YES); NSString *documentspath = [DocPath objectatindex:0];//get cache directory Nsarray *cacpath = Nssearchpathfordirectoriesindomains (Nscachesdirectory, Nsuserdomainmask, YES); NSString *cachepath = [cacpath objectatindex:0];//library directory Nsarray *libspath = Nssearchpathfordirectoriesindomains ( Nslibrarydirectory, Nsuserdomainmask, YES); NSString *libpath = [libspath objectatindex:0];//temp directory NSString *temppath = Nstemporarydirectory ();


5. introduce XMPP ? What are the pros and cons?

XMPP : The extensible Messaging and Presence Protocol (Extensible Communication and Presentation Protocol)

An XML-based point-to-point Instant Messaging protocol.
Advantages: Open, standard, proven available, decentralized, safe, scalable, flexible, versatile.

Disadvantage: Data load is too heavy, no binary data


6. please write separately SEL , ID the meaning?

Dynamic Binding Methods Dynamic type


This article is from the "http://fanyuecheng.blog.51cto.com/9529438/1686195 blog" blog, please make sure to keep this source.

iOS face question Six

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.