objective c - Assigning UTI to file type -


I am trying to add UTI for a pair of file types, matching the detail I think I Systematic setup has been found - At the very least, file extension -> UTI mapping is recognized (I have notified it as an imported type in info.plist) However, when I try to stop UTI from my test file I am a dynamic person TI is back. Here is sample code that I am using to test these two cases:

  NSString * previewTypeUTI = zero; NS URL * Preview file URL = [NSUr file URL with path: @ "/ user / eLayer / desktop / EWF / The Tainfile.Mayica1"]; [PreviewFileURL getResourceValue: & amp; Type to preview UI: NSURLTypeIdentifierKey error: zero]; NSLog (@ "% @", PreviewTypeI); // # 1 NSString * testUTI = (NSString *) UTTep crateptfiledEditification tag (kUTTagClassFilenameExtension, (CFStringRef) [previewFileURL path extension], tap); NSLog (@ "% @", TestUti); // # 2 [Testi release];  

NSLog # 1 print out prints "dyn. ########" and NSLog # 2 "com.mycompany.filetype1". I expected that they should print the same thing, is there some additional step to get the file-> UTI mapping work, or is it a case of launch services that needs to be captured?

Just using Extension-> UTI Mapping is not an option because I want to use some APIs that take advantage of UTI and it seems like using API file-> UTI mapping is.

For completion, here is the plast entry for imported types:

<> pre & lt; Key & gt; UTImportedTypeDeclarations & lt; / Key & gt; & Lt; Array & gt; & Lt; Dict & gt; & Lt; Key & gt; UTTypeConformsTo & lt; / Key & gt; & Lt; Array & gt; & Lt; String & gt; Public.disk image & lt; / String & gt; & Lt; / Array & gt; & Lt; Key & gt; UTTypeDescription & lt; / Key & gt; & Lt; String & gt; File type1 & lt; / String & gt; & Lt; Key & gt; UTTypeIdentifier & lt; / Key & gt; & Lt; String & gt; Com.mycompany.filetype1 & lt; / String & gt; & Lt; Key & gt; UTTypeTagSpecification & lt; / Key & gt; & Lt; Dict & gt; & Lt; Key & gt; Public.filename-extension & lt; / Key & gt; & Lt; Array & gt; & Lt; String & gt; Myext1 & lt; / String & gt; & Lt; / Array & gt; & Lt; / Dict & gt; & Lt; / Dict & gt; & Lt; Dict & gt; & Lt; Key & gt; UTTypeConformsTo & lt; / Key & gt; & Lt; Array & gt; & Lt; String & gt; Public.disk image & lt; / String & gt; & Lt; / Array & gt; & Lt; Key & gt; UTTypeDescription & lt; / Key & gt; & Lt; String & gt; File type 2 & lt; / String & gt; & Lt; Key & gt; UTTypeIdentifier & lt; / Key & gt; & Lt; String & gt; Com.mycompany.filetype2 & lt; / String & gt; & Lt; Key & gt; UTTypeTagSpecification & lt; / Key & gt; & Lt; Dict & gt; & Lt; Key & gt; Public.filename-extension & lt; / Key & gt; & Lt; Array & gt; & Lt; String & gt; Myext2 & lt; / String & gt; & Lt; / Array & gt; & Lt; / Dict & gt; & Lt; / Dict & gt; & Lt; / Array & gt;

Well, it's close to a year, but I had to know it again today And I think what I did was wrong. It looks like you need to include public.data as a type, even if public.disk-image is the first public.data Corresponds to . Therefore, the UTTypeConformsTo array should look like this:

  & lt; Key & gt; To do UTTIP convergence & lt; / Key & gt; & Lt; Array & gt; & Lt; String & gt; Public.data & lt; / String & gt; & Lt; String & gt; Public.disk image & lt; / String & gt; & Lt; / Array & gt;  

After making this change, my above comparison of file-> UTI and Extension-> UTI now produces the same results.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -