iOS Related study questions

Source: Internet
Author: User
<span id="Label3"></p><p><p>1.iOS how to deal with the app version upgrade, the data structure changes?</p></p><p><p>When the General Program app is upgraded, the database may change, such as adding table fields, adding tables, etc. At this point there are two actions: 1 is without mercy, the local old database is deleted directly, re-establish a new database; 2 is the database migration, update the DATABASE. The first case is a simple rough type, but does not retain any historical data and is generally not recommended for Use.</p></p><p><p>2. What are the drawbacks of a single meeting?</p></p><p><p>Pros: A. Instance control: Singleton mode prevents other objects from instantiating copies of their own singleton objects, ensuring that all objects have access to unique Instances.</p></p><p><p><span class="Apple-tab-span">B. flexibility: because classes control the instantiation process, classes can flexibly change the instantiation process.</span></p></p><p><p>Cons: A. Overhead: Although the number is small, there is still some overhead required to check for instances of the class each time the object requests a reference. This problem can be resolved by using static Initialization.</p></p><p><p><span class="Apple-tab-span">B. Possible development confusion: when using singleton objects, especially those defined in a class library, developers must remember that they cannot instantiate objects using the new Keyword. Because library source code may not be accessible, application developers may unexpectedly find themselves unable to instantiate this class Directly.</span></p></p><p><p><span class="Apple-tab-span">C. Object lifetime: the problem of deleting a single object cannot be Resolved. In a language that provides memory management, such as A. NET framework-based language, only a singleton class can cause an instance to be deallocated because it contains a private reference to the Instance. In some languages, such as C + +, Other classes can delete object instances, but this results in a floating reference in a singleton class.</span></p></p><p><p>Note: Singleton objects are released when the app terminates</p></p><p><p>3. How do I store user sensitive information? such as token and account Password.</p></p><p><p>userdefault, keychain, etc.</p></p><p><p>4.iOS signature mechanism</p></p><p><p>http://www.jianshu.com/p/ad29445eb91c</p></p><p><p>5.NSNotificationCenter How do I automate the removal of removeobserver?</p></p><p><p>http://blog.csdn.net/xmios/article/details/51637074</p></p><p><p>The main implementation of the two methods, one is-(void) xmdealloc, the other is-(void) receivenotificationresult: (id) sender, The former is mainly to intercept the registered listener object destruction method, And before its destruction to do something, such as canceling the listener object, while the original implementation of The-(void) Xmdealloc reset, the Listener object Class-(void) Deallco reset, The latter is mainly to intercept the notification callback method, before the notification callback to do something before the execution, Also removes the listener object, and then resets the corresponding method</p></p><p><p></p></p><p><p>iOS Related study questions</p></p></span>

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.