Re: NSSecureCoding & Nested Collections & macOS 11

2020-09-05 Thread Markus Spoettl via Cocoa-dev

On 9/3/20 12:15 PM, Markus Spoettl via Cocoa-dev wrote:

On macOS 11 this produces the following exception:

--
-[NSKeyedUnarchiver _validateDecodeCollectionAllowedClassesRequirementsWithClasses:]: This 
method only supports decoding non-nested collections. Please remove the following or use 
'-decodeObjectOfClasses: forKey:' instead:

 (
     NSDictionary (0x7fff88714520) 
[/System/Library/Frameworks/CoreFoundation.framework]
 )
--


It Was All Our Fault (tm), surprisingly :)

Turns out we have an NSCoder extension that helps with secure coding and 
declares

- (NSArray *)decodeArrayOfObjectsOfClasses:(NSSet  *)classes 
forKey:(NSString *)key

Apple must have seen it because the exact same method is not in NSCoder directly. 
Apparently the collision wasn't resolved to call the new instance method, but something 
else (probably -decodeObjectForKey:).


Changing the extension's method name(s) to something more unique fixed the 
problem.

Regards
Markus
--
__
Markus Spoettl
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSecureCoding & Nested Collections & macOS 11

2020-09-03 Thread Markus Spoettl via Cocoa-dev

On 9/3/20 9:12 PM, Jens Alfke wrote:

That sounds like a framework bug, since the warning is telling you to use the 
method
you're already using. I'd file a bug report with Apple.


Agreed and I did as did a user a couple of months ago. What is strange is that this wasn't 
fixed months ago, as any app deserializing such structures would be affected. There must 
be thousands.


Regards
Markus

--
__
Markus Spoettl
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSecureCoding & Nested Collections & macOS 11

2020-09-03 Thread Jens Alfke via Cocoa-dev
That sounds like a framework bug, since the warning is telling you to use the 
method you're already using. I'd file a bug report with Apple.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSSecureCoding & Nested Collections & macOS 11

2020-09-03 Thread Markus Spoettl via Cocoa-dev

Hi,

  my app implements secure decoding for all its serialization and it worked fine up until 
macOS 11. Now the deserialization chokes on nested collections like this


NSArray of NSDictionary containing [NSNumber, NSString, NSDate] (both keys and 
objects)

What previously worked no longer does:

NSSet *allClasses = [NSSet setWithObjects:
[NSArray class], [NSDictionary class],
[NSNumber class], [NSString class], [NSDate class],
nil];

[decoder decodeObjectOfClasses:allClasses forKey:@"somekey"];

On macOS 11 this produces the following exception:

--
-[NSKeyedUnarchiver _validateDecodeCollectionAllowedClassesRequirementsWithClasses:]: This 
method only supports decoding non-nested collections. Please remove the following or use 
'-decodeObjectOfClasses: forKey:' instead:

(
NSDictionary (0x7fff88714520) 
[/System/Library/Frameworks/CoreFoundation.framework]
)
--

Of course leaving out NSDictionary produces a different exception about the decode 
encountering an NSDictionary object.


Something has changed, obviously. Can someone enlighten me how one is supposed to decode 
those kinds of objects? It's no option to change the encoding.


Thanks for any pointers

Regards
Markus

--
__
Markus Spoettl
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com