Is it not safe to call Accessor methods in init and dealloc methods in Objective C?
标签:
objective-c
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Custom Marker performance iOS, crash with result “
- Why is my library not able to expand on the CocoaP
It depends on the setters. Some may be safe to call, some not. The problem is you can’t be sure which are, since subclasses can override them. If a subclass overrides a setter you use in
-init
you’re calling it before the subclass is fully initialized which is a potentially unsafe operation.You may also want to look at this question.
There shouldn't be a problem though not sure why you would want to call accessors in init or dealloc. Also you don't really need to call accessors since you are in an instance method and can reference the variables directly.