1. What happens when a null pointer (nil pointer) invokes a method?
Safe and sound-this is the message mechanism that OC comes with, nil can also send messages without error
2. Why is Retaincount absolutely not available in the published code? Please give two relatively independent explanations.
A, because the retaincount is not reliable, can not really reflect the reference count of an object
B, use Alloc release and other things, each corresponding, do not need to retaincount
C,app already recommended arc, not even release, not to mention Retaincount
-retaincount is too much affected by time and the framework to accurately reflect the reference count of memory
-retaincount is easy to confuse people, to take the standard memory management is the kingly
3. Find or resolve a memory leak process recommendation
Using Xcode's Tools,
Analyze to see various tips (you can open a variety of annoying tips in building setting)
Profile to follow up on some specific memory points
Follow the specific code to see some key points for block, delegate, etc.
Using instruments as a means of dynamic analysis and Xcode's static memory analysis
4. Autorelease Pool is the process of operation of the program.
Xcode has a layer of nsautoreleasepool in the outer layers of code written by the developer. Set up a recycle pool stack each time the object sends a AUTORELEASE message, the reference count of the object does not really change, but instead adds a record to the pool, noting the object's requirements. Finally, when the pool sends a drain or release message, this requirement for all objects in the pools is executed. By the way:-the application is not based on "application Kit", like "command-line tool" because it does not have built-in "autorelease pools" support. -Create a thread, you must create a ' autorelease Pool ' instance at the beginning of the process. Conversely, it can cause a memory pool leak. Too many temporary objects are created within a loop, and you should create a "autorelease Pool" object for them and destroy them before the next loop.
5. What is the difference between atomic (atomic) and non-atomic (non-atomic) attributes when handling attribute declarations?
is thread safe
Atomic is an atomic, multi-threaded time that can prevent the write operation from being read before it is finished.
When it comes to multi-threading, The Atom (atomic) can be said to be thread-safe, that is, when reading the variable of this property, there will be some extra action (such as a lock), so the atomic will be more secure but more time-consuming.
6. Traverse a Nsarray and a nsset, which one is faster?
It actually means asking, which is faster to traverse a list and hash table?
If you only need to save and traverse some data, or the number of elements is small, choose Nsarray, even if you need to find the function, do not use Nsset.
Use Nsset only if the number of elements is large, or if you need to guarantee data uniqueness.
7. What's the difference between copy and retain?
One is a copy of the content, a reference count of +1, (NSString is special, two functions almost the same) it is important to note that a custom class needs to override a method to implement its own deep copy:
-(ID) Copywithzone: (Nszone *) zone{
Grandsuper *sccopy;
Sccopy = [[self class] allocwithzone:zone]init];
return sccopy;
}
What is the difference between 8.frames and bounds?
Frame relative to Superview
Bounds relative to its origin, it is generally (0,0), the device facing changes, bounds will change
9. What happens when you execute the following code?
Ball *ball = [[[[Ball alloc] init] autorelease] autorelease];
Crashes because of a recurring release that crashes the next time the recycle pool is reclaimed
To be resolved:
In C, how can you reverse a string in as short a time as possible?
Explains how code signing works.
What does the posing in objective-c mean?
Lists the 6 tools in the standard Xcode version.
What is the disadvantage of OC language?
IOS Details Issue