tranvutuan
tranvutuan

Reputation: 6109

what type of array of CFBundleIconFiles

CFBundleIconFiles is type of an array. My question is what type of array is. Should it be NSArray or NSMutableArray. Assumed we already have

NSDictionary    *plistDictionary = [[NSBundle mainBundle] infoDictionary];

My question is which declaration below is a right one

NSMutableArray  *array           =  [plistDictionary objectForKey:@"CFBundleIconFiles"];
NSArray         *array           =  [plistDictionary objectForKey:@"CFBundleIconFiles"];

Upvotes: 0

Views: 120

Answers (1)

borrrden
borrrden

Reputation: 33421

It should be NSArray. There are a few exceptions, but the standard is that when you read collections from files they are immutable by default. Both of these will compile and work because objectForKey returns id, however you will get a runtime error if you try to modify it.

Upvotes: 2

Related Questions