objective c - iOS 9.0 - NSMutableDictionary causing EXC_BAD_ACCESS -
my application includes singleton class represents general data. latter contains following atomic property :
// .h file @property (atomic, strong) nsmutabledictionary *datadictionary; // .m file @synthesize datadictionary;
the dictionary being used simultaneously different threads (both setter , getter), , worked normal without crashes on ios 6.0 - 8.4. have run application on ios 9.0 simulator , crashed (exc_bad_access) in arbitrary code calling dictionary setobject:forkey:
method.
- does knows have changed in ios 9.0 can cause crashes ?
- any clue how solve issue ?
atomic
on property doesn't mean think does. atomic
means property value (i.e. pointer) protected parallel access, doesn't protect contents of dictionary @ all.
if code worked on previous versions of ios, fluke. code crash randomly if allowing multiple threads access single nsmutabledictionary
in way.
you need add locking discipline of sort between these multiple threads.
Comments
Post a Comment