Sounds like NSPropertyListSerialization is what you’re after.

https://developer.apple.com/documentation/foundation/nspropertylistserialization

b

Sent from my iPhone

> On May 8, 2021, at 5:12 PM, Alex Zavatone via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> I’m reading a configuration plist like so.
> 
> NSFileManager *fileManager = [NSFileManager defaultManager];
>    BOOL success = [fileManager fileExistsAtPath:filePath];
> 
>    if (success) {
> 
>        _configurationDictionary = [[NSMutableDictionary 
> alloc]initWithDictionary:[NSDictionary 
> dictionaryWithContentsOfFile:filePath]];
> 
> 
> 
> 
> In some cases, I want the plist to be a dictionary.  In others, I want it to 
> be an array.
> 
> How would anyone recommend to make this a generic method to that could handle 
> if the contents of the plist was an array or a dictionary?
> 
> Thanks in advance.
> Alex Zavatone

_______________________________________________

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

Reply via email to