NSKeyedArchiver with NSMutableArrays and OData Objects causing Memory Leaks
-
30-06-2021 - |
Pergunta
I have a memory leak problem using OData where data retrieved from the OData web service is returned in an NSMutableArray
, i.e. return [response getResult]
, and then stored using NSKeyedArchiver
as follows:
QueryOperationResponse *response = [dropDownQuery execute];
...
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:[response getResult]];
When I run the Memory Leak Instrument from Xcode, I am getting a lot of leaks on the NSKeyedArchiver line.
I am thinking that I need to some how make sure that the data retrieved from OData and returned in the NSMutableArray
complies with the NSCoding
protocol? The data I am getting back are just strings and integers.
Can I please have some help with this and if anyone has any suggestions on making any objects in NSMutableArray
comply with NSCoding
, that would be great.
Solução
The fix is to modify the proxy class created from OData as it needs to be modified to comply with the NSCoding protocol.