William GP
William GP

Reputation: 1332

How can I determine if the user has iCloud Photo Library turned on or not?

I am accessing the user's photos for uploading from PHPhotoLibrary, but I need to be able to tell if they have iCloud Photo Library turned on or not.

If they have iCloud Photo Library, then they will have a photo album titled 'All Photos' - which they won't have if iCloud Photo Library is turned off.

Upvotes: 4

Views: 1612

Answers (2)

William GP
William GP

Reputation: 1332

Not a direct answer to the question, but a similar query would be determining whether each picture is in iCloud or on the device. In which case bcattle's answer here should do the trick:

Upvotes: 0

Aviram
Aviram

Reputation: 3067

I don't think there's any straight-forward way to do this. However, there are two workarounds that I am familiar with:

  1. Check the localizedTitle of assetCollection with subType of PHAssetCollectionSubtypeSmartAlbumUserLibrary. The localizedTitle will be "Camera Roll" for iCloud disabled devices, and "All Photos" for iCloud enabled devices. Keep in mind that if Apple changes the name in the future, it would break.

  2. Each PHAsset object has a sourceType. For iCloud photos, the value would be PHAssetSourceTypeCloudShared. The bad thing about this method is that if the user does not have photos on iCloud at the moment, you won't be able to say that it does have iCloud Photo Library disabled.

Upvotes: 7

Related Questions