Re: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-10 Thread Mark Allan via Cocoa-dev
>> Now that Alex has the answer to his problem, can I ask a follow-up question >> based on this line in his initial email? >> >>> On 9 May 2021, at 1:12 am, Alex Zavatone via Cocoa-dev >>> wrote: >>> _configurationDictionary = [[NSMutableDictionary >>> alloc]initWithDictionary:[NSDictiona

Re: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-10 Thread Mike Abdullah via Cocoa-dev
> On 10 May 2021, at 10:52, Mark Allan via Cocoa-dev > wrote: > > Hi, > > Now that Alex has the answer to his problem, can I ask a follow-up question > based on this line in his initial email? > >> On 9 May 2021, at 1:12 am, Alex Zavatone via Cocoa-dev >> wrote: >> _configurationDic

Re: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-10 Thread Mike Abdullah via Cocoa-dev
Further to earlier answers, it’s worth pointing out you’ve got an anti-pattern in this code. You go: 1. Check if file exists 2. Try to read file There is no point to step 1. Just do step 2 directly, and handle failure there. If you _don’t_ handle failure at step 2, you’ve got yourself a nasty l

Re: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-10 Thread Mark Allan via Cocoa-dev
Hi, Now that Alex has the answer to his problem, can I ask a follow-up question based on this line in his initial email? > On 9 May 2021, at 1:12 am, Alex Zavatone via Cocoa-dev > wrote: >_configurationDictionary = [[NSMutableDictionary > alloc]initWithDictionary:[NSDictionary > dict