IOS Learning (error 1 encountered in the Project)
1. [AppModel copyWithZone:]: unrecognized selector sent to instance 0x7ffda9f4cf70
* ** Terminating app due to uncaught exception 'nsinvalidargumentexception ', reason:'-[AppModel copyWithZone:]: unrecognized selector sent to instance 0x7ffda9f4cf70'
*** First throw call stack:
Cause of this error: attribute definition issues should be noted that when defining an attribute
Several problems may occur during the property operation.
Nonatomic: single thread, High Efficiency
Atomic: multi-thread, low efficiency, but default
ReadWrite: readable and writable, which is also the default
ReadOnly: Read-Only
Assign: it refers to the int, float. And other numeric types. It is the default
Copy: Refers to a string object. For example, name
Retain: indicates an object. For example, time object
Strong: strongly referenced
Weak: weak reference
The cause of my error is that when I define a class object, I misuse copy instead of strong.
2. When using tableView, you will find that this method is not executed sometimes. The reason is: the frame of _ tableView is not set, and _ dataArry is not assigned a value. Another way is to use an Asynchronous Method When retrieving data, but the wood has to refresh tableView data.
-(UITableViewCell *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) indexPath {
Return nil;
}
3. Errors Caused by data NSData not initialized
Terminating app due to uncaught exception 'nsinvalidargumentexception ', reason: 'Data parameter is nil'
4. If the retrieved data is null, the following error occurs:
* ** Terminating app due to uncaught exception 'nsangeexception', reason: '***-[_ NSArrayM objectAtIndex:]: index 3 beyond bounds [0.. 2]'