Skip to content

Conversation

paulb777
Copy link
Member

Fix #6502

@@ -166,7 +166,11 @@ - (void)runLegacyMigration:(FRepoInfo *)info {
// it'll go fine :P
[writes enumerateKeysAndValuesAsData:^(NSString *key, NSData *data,
BOOL *stop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Update the deprecated API when minimum iOS version is 11+.
id pendingPut = [NSKeyedUnarchiver unarchiveObjectWithData:data];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a great idea to silence this particular deprecation warning. I would go with it only if refactoring to use GULSecureCoding is too complicated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but I'm not sure it's worth the time to update and test this rarely executed code. @schmidt-sebastian any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the concern that we need to specify a class type (which would be FPendingPut)?

linkedin/cassette#18 has a wrapper that uses slightly different APIs that allows to drop usage of this method while continuing to use untyped types.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maksymmalyhin Correct me if I'm wrong, but my understanding of the concern is using the old unarchive API that doesn't check for NSError's. And GULSecureCoding wraps up the pre and post iOS 11 API nicely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paul, there are two concerns here - the one you described and using NSCoding instead of NSSecureCoding which implies the concern mentioned by Sebastian. So ideal fix will be updating FPendingPut and related classes to adopt NSSecureCoding and use GULSecureCoding to avoid code duplication related to deprecated methods and error handling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the unit or integration tests exercise this line of code, so I'm hesitant to do more than add the pragma clang diagnostic ignored.

@paulb777 paulb777 merged commit dc1451d into master Oct 9, 2020
@paulb777 paulb777 deleted the pb-db-depre branch October 9, 2020 23:27
@KevinVladG
Copy link

Thank you!! @paulb777