There is a method:
- (void)doSmth:(NSString *__strong*)str {
NSLog(@"%@", *str);
}
What does it mean when __strong follows the class of a method parameter? Why are there two asterisks?
Two asterisks mean it's a pointer to a pointer.
__strong
is the opposite of __weak
which you probably already know. It means we are talking about a strong reference here. While we hold to that reference, the object won't be deallocated.
Also we need to know that writing __strong Type *varName
is technically wrong (although it works and almost everybody uses it). The correct syntax is Type * __strong varName
.
Your syntax is a pointer to a strong reference to NSString
. It means that when an object is returned from the method, there must be a release
call from ARC to properly deallocate that object.
Please see the related question: NSError and __autoreleasing and the official documentation: Transitioning to ARC
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With