I'm writing a basic image viewer with image metadata support, but I'm having a little trouble when specific metadata can't be found.
I've extracted the metadata from the image and now I'm creating an array to hold the specific data. BUT, when some data isn't available, the return value will be nil, thus terminating my array, which gives problems for me later on.
How can I make the return value an empty string? (e.g. @"")
If any more info is needed, please let me know..
Thanks in advance!
I've extracted the metadata from the image and now I'm creating an array to hold the specific data. BUT, when some data isn't available, the return value will be nil, thus terminating my array, which gives problems for me later on.
How can I make the return value an empty string? (e.g. @"")
Code:
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef) url, NULL);
NSDictionary *metadata = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, 0, NULL);
metadataList = [NSArray arrayWithObjects:
[NSString stringWithFormat:@"%@ x %@", [metadata objectForKey:(id)kCGImagePropertyPixelWidth],[metadata objectForKey:(id)kCGImagePropertyPixelHeight]],
[metadata objectForKey:(id)kCGImagePropertyProfileName], etc.etc..
If any more info is needed, please let me know..
Thanks in advance!