0

I'm complete Xcode newbie and I'm trying to find out if I need to enable CloudKit in order to access iCloud Photos, or does the PhotoKit handle everything? Also I'm guessing it's probably a good idea to have a separate developer account when messing with iCloud photos, does Apple allow a separate account?

RickBowden
  • 189
  • 2
  • 15

1 Answers1

2

PhotoKit uses CloudKit behind the scenes, so it's using its own data containers (etc) and you don't need to create your own.

If you're logged into an iCloud account with iCloud Photo Library enabled, PHAsset (and related) fetch methods will always return all the items "in your library", regardless of whether the photo/video data for those items is currently stored on your device. When you want to display or edit assets, use PHImageManager APIs to find out if data is in iCloud and respond to downloading.

AFAIK, there's no "sandbox" for Photos content. If you want to test your app without giving it access to your "real" iCloud photo library, use a separate (free) iCloud account. (Note, however, that you don't have much to fear from a buggy dev build of your app running amok in your library — destructive operations in PhotoKit like deleting assets always pop an alert for user confirmation.)

rickster
  • 124,678
  • 26
  • 272
  • 326
  • Thanks very much for that info rickster :) – RickBowden Jul 16 '15 at 07:19
  • Do you have to add iCloud to the list of capabilities within Xcode? If I'm right then that means I need to sign up as a developer to access iCloud photos. I signed into the iPhone simulator with a normal Apple ID (not one registered as a developer) and I couldn't enable iCloud Photos despite being able to enable iCloud and get Calendar entries downloaded. – RickBowden Jul 21 '15 at 07:05
  • I'm not sure if iCloud Photo Library is available in the simulator. You still don't need anything special for your app, though. – rickster Jul 21 '15 at 07:28
  • How do you test it then. Do you have to connect a real iPhone. – RickBowden Jul 21 '15 at 11:26