4 Replies
      Latest reply on Nov 18, 2019 10:44 AM by TomE
      coderchrismills Level 1 Level 1 (0 points)

        I'm working on an app that uses photos (including Live Photos) from the users Photo Library. I'm currently storing the localIdentifier in CoreData and everything is working great. However I wanted to see if the database was persistent when the user restored from an iCloud backup. The database is intact, however all calls to fetchAssets return no items.

         

        let options = PHFetchOptions()
        options.includeAllBurstAssets = false
        options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
        options.fetchLimit = identifiers.count
                
        let assetResult = PHAsset.fetchAssets(withLocalIdentifiers: identifiers, options: options)
        var assetArray:[PHAsset] = []
        for i in 0..    let asset = assetResult[i]
            assetArray.append(asset)
        }

         

        Am I missing something or is there a more persistent way of referencing photos in the users Photo Liibrary?

         

        I am also concerend some people claim it can change between OS updates.