Description
I had a problem with uploading document and the issue is that the content type is always "application/octet-stream" when i checked the code i found this function:
/*
Borrowed from http://stackoverflow.com/questions/2439020/wheres-the-iphone-mime-type-database
*/
-
(NSString *)guessMIMETypeFromFileName: (NSString *)fileName {
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)[fileName pathExtension], NULL);
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType);if (UTI) {
CFRelease(UTI);
}if (!MIMEType) {
return @"application/octet-stream";
}
return (__bridge NSString *)(MIMEType);
}
i guess this two lines don't work anymore to determine MIMEType
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)[fileName pathExtension], NULL);
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType);
it is always null