just curious if anyone knows a good tutorial or some info on how to create a custom file type for an application. By default, XCode uses binary for saves (and it's fully functional) but obviously it's better to have a custom file type for an application, rather than a binary file. Is this easier said than done?
After some false starts in earlier releases, Mac OS X 10.3 introduced the concept of Uniform Type Identifiers (UTI) to describe how files are associated with applications. UTIs try to incorporate all the previous mechanisms, including file extensions, legacy Mac OS file types, MIME types, etc. Applications can declare UTI information in the app bundle Info.plist. There is an overview in the Apple Developer documentation here. By the way, not everyone is convinced that UTIs are the best solution.
Related
Back in the day, one of the Quirks of the Macintosh OS was that files had two "forks", a "resource fork" which held resources used by software through dedicated resource APIs, and a "data fork", which held the plain old data like on other systems, including binary code, text in plain text files, etc.
A little-known feature of HFS+, introduced with Mac OS 8.1 in 1998, is that you can have any number of named forks of any file. Similar to the also little-known feature of NTFS called "ADS" (Alternate Data Streams).
From Wikipedia:
HFS Plus permits filenames up to 255 characters in length, and
n-forked files similar to NTFS, though until 2005 almost no system
software took advantage of forks other than the data fork and resource
fork
Apple doesn't seem to document the APIs for making use of those extra forks any longer.
Do we know if and when Apple officially deprecated the feature? If not, do we know when the APIs vanished from the documentation.
Back in the day, one of the Quirks of the Macintosh OS was that files had two "forks",
Quirk? Rather a well known feature.
Similar to the also little-known feature of NTFS called "ADS" (Alternate Data Streams).
It was a great way to organize Data.
Apple doesn't seem to document the APIs for making use of those extra forks any longer.
They are well documented in according Manuals - even online like here. Ofc, there is no reason to go into them since they are deprecated since 10.9 (Mavericks)
Do we know if and when Apple officially deprecated the feature?
Yes, they did, and the moment in time was October 2013 when OSX 10.9 was released.
If not, do we know when the APIs vanished from the documentation.
Still there today ... at least when looking in the appropriate API documentation for any Mac OS between 1999 (MacOS 8) and 2013.
Always look at the API for the Version used. Actual OSX does no longer encurrage its use, so not to be found there.
I know the Wordnet webpage cites that it comes with a C interface included. However, I am having significant trouble adding it to my project. My question is two fold.
First: Does a machine need to have wordnet installed to utilize the API (or can the data be read a runtime from the dict files? and thus distributed to machines that do not have wordnet installed)
Second: How can you include Wordnet in a C project. I've tried adding the source files directly, but it crashes on init(). I've stepped through the debugger and it looks like it is looking to load the files from my local drive rather than the included files in the project. Is there a way to prevent this for machines that do not have Wordnet installed (from part 1).
Thank you for the help,
Unless I'm mistaken and you're referring to a different WordNet, there has been a Cocoa front-end available for years here.
Just found this today. Might be helpful, as it only requires adding the sqlite.db file of WordNet and provides a super super thin Objective-C wrapper on the sqlite call to talk to the database. Using this as a template for your understanding should allow you to extend it to allow various queries.
https://gist.github.com/atduskgreg/c30a5fb167f4c35d6f89
EDIT: With the above example, you can see the format the query takes. With that knowledge, you could grab the sqlite file for the WordNet database from:
https://code.google.com/p/synonym/downloads/detail?name=wordnet30.1.tar.gz&can=2&q=
then either just use the C calls for sqlite or pick a more robust Objective-C wrapper like:
https://github.com/ccgus/fmdb
I'm new programming with Objective-C (my strongest skills is .Net), on .Net there's a configuration file that the user can modified and the app gets this modified values.
My question is: There's something similar on Objective- C (my app is for Mac OS X)?
Thank you
If you're talking about preferences, that's handled by the NSUserDefaults class. The standard location for preferences to be written is ~/Library/Preferences/bundleidentifier.plist (where bundleidentifier is your bundle's identifier — e.g., com.apple.preview for Apple's Preview app). You can technically write plists anywhere, but it's bad form to go scribbling outside the standard locations without the user's say-so.
What is the Best way i can do Parsing or Writing into XML using cocoa for mac10.3.9.?
Im mentioning the version of OS specifically because, i read in the documentation like, Mac 10.3.9 sdk does not support NSXML class.?
I Found an OpenSource libaray (libxml), is it the only library i can use????
Please give me some suggestion regarding the above....
Kindly reply Soon...
Thank you
Pradeep.
According to my copy of the documentation, the NSXMLParser class is available on Mac OS X 10.3 and later.
If for some reason you cannot use that, you can also use the Core Foundation XML Parser functions (search for CFXMLParser). This is a C-based API also developed by Apple. It will be deprecated in future versions of Mac OS X (after Snow Leopard), but since you're working on 10.3 that won't be a concern for you.
Many who cannot use those two also use libxml. Objective-C is able to use any C-based libraries with no penalty. I'm fairly certain Mac OS X ships with a copy of libxml you can link to (no need to download, build, or ship the library yourself; though if you want to, you certainly can).
What's best is going to depend on what features you need. Namespaces, for example, aren't fully supported by NSXMLParser in 10.3, but they are supported in 10.4.
Thanks for the replies....
I used libxml for xml parsing, it was working fine.
But still it has some problems like, even if the xml file is half consistent(i mean if the xml is corrupt, it loads the xml file).
libxml with xpath made things quite easy for xml parsing.
I want to update/upgrade the standard Leopard install of Sqlite3 to >3.5 to use the new sqlite_xxx_v2 methods from a Cocoa project.
I can't seem to find any information on how to do this. Does anyone have any tips or a site that outlines the update procedure.
Also is 3.5+ supported on the iPhone. I understand it's embedded so shouldn't be an issue...
What you want to do is grab the amalgamation sources from http://sqlite.org/download.html . Then just compile that into / add it to your project. You don't want to replace the system sqlite- that'll have unintended consequences in other applications. Plus, I'm pretty sure the system sqlite isn't a stock sqlite... Apple has probably made their own modifications to it that core data relies on.
You can read up on the amalgamation stuff here: http://sqlite.org/amalgamation.html , but in short: '''The amalgamation is a single C code file, named "sqlite3.c", that contains all C code for the core SQLite library and the FTS3 and RTREE extensions'''
I'd also suggest not using the sqlite calls directly, they weren't designed to be used that way (says the author of sqlite). Instead, there are a number of cocoa wrappers out there, including fmdb: http://code.google.com/p/flycode/source/browse/trunk/fmdb/ (which I wrote) :)
-gus
You don't really want to upgrade the system version of SQLite on Mac OS X. The reason is that all Mac OS X software is qualified against the versions of the packages that it includes, as built by Apple's build process. Installing a different version of a package, or even building the same version yourself but doing so slightly differently than Apple does, may result in a system that behaves unexpectedly.
Finally, if you embed a newer version of SQLite — or any Open Source library or framework included with Mac OS X — into your own application, you should be sure to integrate the Darwin changes for it from Apple's public source site. That way you can be sure you'll get as close to the same behavior as possible from the library you've built yourself as the version Apple ships, which is especially important when it comes to functionality like file locking in databases.
I don't believe i've updated my version, but it's currently at 3.4.2, and i'm able to use the new methods with the current version.
And i'm running 10.5.5 with the latest (public) iPhone SDK.
It would likely be easier to just drop the library into your project and link it in from there.