Skip to content

Commit

Permalink
Merge pull request #279 from vladiulianbogdan/278_fix_compatibility_i…
Browse files Browse the repository at this point in the history
…ssue

Fix for file compatibility issue caused by migration to ARC.
  • Loading branch information
fpillet authored Feb 17, 2019
2 parents c75ac1d + 7f5b51c commit 85290a5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Desktop/Classes/LoggerConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,35 @@ - (id)initWithCoder:(NSCoder *)aDecoder
if ((self = [super init]) != nil)
{
_clientName = [aDecoder decodeObjectForKey:@"_clientName"];
// When the code was converted to ARC, some of the keys have changed.
// In order to be backward compatible, we also need to check if the coder
// is using the old keys.
if (_clientName == nil)
_clientName = [aDecoder decodeObjectForKey:@"clientName"];

_clientVersion = [aDecoder decodeObjectForKey:@"_clientVersion"];
if (_clientVersion == nil)
_clientVersion = [aDecoder decodeObjectForKey:@"clientVersion"];

_clientOSName = [aDecoder decodeObjectForKey:@"clientOSName"];
_clientOSVersion = [aDecoder decodeObjectForKey:@"clientOSVersion"];
_clientDevice = [aDecoder decodeObjectForKey:@"clientDevice"];
_clientUDID = [aDecoder decodeObjectForKey:@"clientUDID"];
_parentIndexesStack = [aDecoder decodeObjectForKey:@"parentIndexes"];
_filenames = [aDecoder decodeObjectForKey:@"_filenames"];
if (_filenames == nil)
_filenames = [aDecoder decodeObjectForKey:@"filenames"];
if (_filenames == nil)
_filenames = [[NSMutableSet alloc] init];
_functionNames = [aDecoder decodeObjectForKey:@"_functionNames"];
if (_functionNames == nil)
_functionNames = [aDecoder decodeObjectForKey:@"functionNames"];
if (_functionNames == nil)
_functionNames = [[NSMutableSet alloc] init];
objc_setAssociatedObject(aDecoder, &sConnectionAssociatedObjectKey, self, OBJC_ASSOCIATION_ASSIGN);
_messages = [aDecoder decodeObjectForKey:@"_messages"];
if (_messages == nil)
_messages = [aDecoder decodeObjectForKey:@"messages"];
_reconnectionCount = [aDecoder decodeIntForKey:@"reconnectionCount"];
_restoredFromSave = YES;

Expand Down

0 comments on commit 85290a5

Please sign in to comment.