1. In the Init method of the class, you should use _value instead of Self.value to access the variable, because the initialization is in progress and the object has not been constructed yet, so it is not possible to determine whether the instance variable can be effectively assigned
2. First the specific init initialization method needs to invoke the specific Init method of the parent class, and then the other INIT methods call this particular Init method
If a subclass declares a particular Init method that is different from a specific Init method of the parent class, the subclass is required to overwrite (override) the specific Init method of the parent class and invoke the specific Init method that the subclass already has
3. In the class method, you should use self instead of the class name, so that his subclasses can also send messages
+ (Instancetype) Randomitem
{
Bnritem *newitem = [[ Self alloc] initwithitemname:randomname valueindollars:randomvalue serialnumber: Randomserialnumber];
return newitem;
}
An array in 4.objective-c can only hold OC objects, so you cannot add the underlying type and C-voice structure, you can first convert the data into OC NSNumber, Nsvalue, NSData, and add to the array
You cannot add nil to an array, but you can use the Nsnull object, nsnull to indicate that the object is nil and is typically used for special operations
[Items addobject:[nsnull null]];
5.unrecognized selector sent to instance 0x100117280 ' This error indicates that there are no methods in the instance that you want to invoke
(You sent a message to an object, and the object does not implement)
There is no namespace (namespace) in 6.OC, but rather a way to add a prefix to the class name
NS prefixes represent NeXTSTEP Company
7. #import and @import
OC compiles some system libraries and caches them, avoiding the need to recompile each time they are referenced in the header file, so you can use the @import Foundation when calling the System library's header file
"IOS programming:the Big Nerd Ranch Guide" "Notes" 1