Search code examples
objective-cfileuti

How to use UTIs to make a new file type?


I have been working on making an application for editing game plugins for a game I made. I needed the files it saves to have a custom format for obvious reasons. Unfortunately, I cannot figure out how to give the file a custom icon.

I did some research last night into UTIs, mostly because they are mentioned wherever icons are talked about. I did what the Apple Documentation said, but it didn't work.

Here is my code so far:

[@"test" writeToFile:@"test.hsimg" atomically:YES encoding:NSUTF8StringEncoding error:NULL];

That works perfectly. The only problem I have now is that there is no icon. Could someone please tell me how I need to setup the UTIs to make it work?


Solution

  • Take a look at these questions:

    How do I associate file types with an iPhone application?

    Creating my own file extension based on plist