Assign property for pointers
When I lately upgraded Xcode to 7.3.1 I suddenly got a lot of errors in one of my older project I wanted to rebuild.
Declaration uses __weak, but ARC is disabled
It’s a standard error if we are using MRR libraries with weak references in ARC project, and it can be fixed pretty easy. So I set Weak References in Manual Retain Release to YES in my project and the CocoaPods configuration and I expected the error to be solved, but unfortunately a new one appeared. 😅
Existing instance variable 'state' for property 'state' with assign attribute must be __unsafe_unretained
SBJSON is using the old concept of dealing with weak references and there is something like that in the source code:
@property (nonatomic, assign) SBJsonStreamParserState *state; // Private
Pretty strange, isn’t it? We have a reference to some object and the assign property modifier. But actually it was a very common practice in iOS 4 and older when there was no weak modifier.
In the newer Objective-C standard we have weak modifier so the bug was easy to fix, but it made me think for a while about iOS toolkit evolution and those little changes that are being silently introduced from time to time. Something that was unnoticed for about 4 years in the project suddenly appeared as an error in the newest Xcode.
Michał Cichoń is a software engineer based in Kraków, Poland.
With over 15 years of experience in web and mobile development, he specializes in building software systems across mobile and backend environments, with a strong focus on product-driven engineering.
Over the years, he has collaborated with financial institutions, biomedical companies, and startups from New York, Berlin, and beyond. He is currently focused on AI systems that support and automate parts of the software development lifecycle.
