Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nutter

macrumors 6502
Original poster
Mar 31, 2005
432
0
London, England
I am trying to set up my app so that it will accept audio files dropped on to the application icon. I'm stuck at the first step - specifying the document types that I want to accept in my Info.plist.

As I understand it, I can use the UTI "public.audio" to avoid having to enumerate every single supported audio format. (I'm not concerned about backwards compatibility.) To this end, I've set up a document type in Xcode's target info window, like this:

DocumentTypeSettings.png


Xcode has added the following to my Info.plist file:
Code:
<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeName</key>
			<string>Audio</string>
			<key>CFBundleTypeRole</key>
			<string>Viewer</string>
			<key>LSItemContentTypes</key>
			<array>
				<string>public.audio</string>
			</array>
			<key>LSTypeIsPackage</key>
			<false/>
			<key>NSPersistentStoreTypeKey</key>
			<string>Binary</string>
		</dict>
	</array>

Unfortunately this doesn't seem to work. I can't get my application to "darken" when I drag an audio file onto it. I have tried cleaning the project and rebuilding, but that doesn't help.

I'm sure I'm missing something very simple, but I have no idea what. Apple's documentation on the subject isn't very helpful - the UTI documentation is quite sparse, and the documentation for setting up document types doesn't show how to use UTIs.

:confused:
 
I spent ages grappling with this, before realising that my application was accepting drops properly in the finder, just not in the dock.

After that I decided this was a bug and gave up trying to get it to work. I went on to add a second document type (public.folder). Lo and behold! Now the dock accepts both audio file and folder drops for my application!

This was in 10.4.9.

Conclusion: There may be a bug in 10.4 that stops the dock from accepting drops when you specify a single document type with a UTI.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.