@IBAction func selectLisaIngestPreviewFolder(_ sender: Any) {
let openPanel = NSOpenPanel()
openPanel.canChooseFiles = false
openPanel.canChooseDirectories = true
openPanel.message = "Select Lisa Preview folder"
let response = openPanel.runModal()
switch response.rawValue {
case 1000:
print(response.rawValue)
case 1001:
print(response.rawValue)
default:
return
}
}
Post
Replies
Boosts
Views
Activity
I tried a different approach to adding the images to the Photo Library, using:
func createStillAssetOnAlbum(asset: URL, album: PHAssetCollection) {
let photoURL = asset
PHPhotoLibrary.shared().performChanges ({
let creationRequest = PHAssetCreationRequest.forAsset()
let placeHolderAsset = creationRequest.placeholderForCreatedAsset
creationRequest.addResource(with: .photo, fileURL: photoURL, options: nil)
guard let albumChangeRequest = PHAssetCollectionChangeRequest(for: album) else {
print("album change request has failed")
return
}
albumChangeRequest.addAssets([placeHolderAsset] as NSArray)
}, completionHandler: { success, error in
if success {
print("photo (and adjustments) saved successfully")
self.importCount += 1
}
else if let e = error {
print("error saving photo (and adjustment): \(e)")
self.nonImportedImageCount += 1
}
})
}
This seems to work as I would expect.
I've tried every combination of interface options, sandboxed, unsandboxed, permissions changes to the .mov files... doesn't seem to have helped.
Can anyone lend some insight?
I think I discovered that CIFilter allows me to do this with CIImage that I then convert to NSImage. (unless there is a better, simpler way?)
There may be a better (or "more correct") solution but I solved it by copying the file I needed into the user's Documents directory then deleting it when it was no longer needed. (it only needed to be there for fraction of a second.)
I'm using a cell based NSTableView.