Value return from [[fileAttributes objectForKey:myKey] objectForKey:@"com.apple.metadata:kMDItemWhereFroms"]
are apple binary plist (bplist00). Use propertyListFromData:mutabilityOption:format:errorDescription:
function of NSPropertyListSerialization
class for Conversion.
NSString* myPath = @"/Users/new/Downloads/TelephoneBill.pdf";
//creating the filemanager
NSFileManager *filemgr = [[NSFileManager alloc]init];
//if the path exists, whiii it exists!
if ([filemgr fileExistsAtPath:myPath])
{
NSLog(@"file exists!");
//Set the fileattributes to the dictionary!
NSDictionary *fileAttributes = [filemgr attributesOfItemAtPath:myPath error:
nil];
for (NSString* myKey in fileAttributes)
{
if ([myKey isEqualToString:@"NSFileExtendedAttributes"])
{
NSLog(@"MyKey = %@ with attribute: %@",myKey, [fileAttributes objectForKey:myKey]);
NSData *whereFromData = [[fileAttributes objectForKey:myKey] objectForKey:@"com.apple.metadata:kMDItemWhereFroms"];
NSString *error;
NSPropertyListFormat format;
id plist = [NSPropertyListSerialization propertyListFromData:whereFromData
mutabilityOption:NSPropertyListImmutable
format:&format
errorDescription:&error];
NSLog(@"plist %@",plist);
}
}
}
else
{
NSLog(@"File does not exist!");
}
plist (
"https://www.airtel.in/myaccount/BillGuide/RevamP/download?fileName=EA29BB",
"https://www.airtel.in/myaccount/BillGuide/billSummary.action?param=myBillSummary&res=6DAED0342C197C"
)