Same point:
Can be used as the return type of a method
Different points:
Instancetype can return objects of the same type as the method's class, and the ID can only return objects of unknown type
Instancetype can only be used as a return value, not as a parameter of a method as an ID
Benefits:
The ability to determine the type of object that helps the compiler to better locate code for us to write problems
[[[Nsarray alloc] init] mediaplaybackallowsairplay];
The return type is instancetype: Because the return value of [[Nsarray Alloc]init] is nsarray*, This allows the compiler to detect whether the Nsarray implements the Mediaplaybackallowsairplay method based on the returned data type. Helps developers find errors during the compile phase.
[[Nsarray array] mediaplaybackallowsairplay];
The return type Id:[nsarray array] Returns the ID type, and the compiler does not know whether an object of the ID type implements the Mediaplaybackallowsairplay method, nor is it able to detect errors for developers in a timely manner.
< Objective-c >id and Instancetype