4

I'm writing an app which saves and loads documents both locally and on iCloud. Locally is working fine, but I'm having a problem with iCloud.

The documents are saved as a package - the UIDocument reads and writes an NSFileWrapper which contains an image file, a thumbnail file, and an info plist. When I save the document to iCloud and then look at the files under 'Manage Storage', I see the individual files instead of the packages; and more importantly when I search for files using NSMetadataQuery it returns an NSMetadataItem for each of the individual files instead of the packages. As a result, my app doesn't realise there are any packages to load and iCloud is pretty useless.

I thought that if I set up the document type and exported the UTI correctly that the packages would be treated properly. Was that right? If so, what's the checklist for setting up a document type as a package? I have:

  • Added a document type
  • set LSTypeIsPackage to YES (I've tried string YES and bool YES)
  • set CFBundleTypeExtensions to an array containing one string: the file suffix
  • set LSHandlerRank to Owner
  • Exported a UTI with the same identifier
  • set it to conform to com.apple.package
  • added a UITypeTagSpecification dictionary, containing an array for the key public.filename-extension, which contains one string: the file suffix

I've also tried adding a matching Imported UTI to match the exported one, but no luck there.

What did I miss?

UPDATE: I notice that the OP in this question is seeing the behaviour I want (even though he doesn't want it) so it must be possible.

Community
  • 1
  • 1
Simon
  • 25,468
  • 44
  • 152
  • 266

1 Answers1

2

Based on this I tried removing the LSItemContentTypes from my plist, and it worked.

Simon
  • 25,468
  • 44
  • 152
  • 266
  • wow. I was banging my head on my keyboard for nearly a month over this issue. It clearly seems like a bug. Thanks. – auco Feb 20 '13 at 22:31
  • I am having the exact same issue since yesterday. I am unable to solve this by removing LSItemContentTypes. Please suggest if it can be achieve by any other way. Thanks alot. – Nabeel Thobani Dec 12 '13 at 04:19
  • What about the situation, when I need LSItemContentTypes to enable importing files of this filetype to my app? – kavalerov Sep 30 '14 at 17:47