Cocoa ошибка 1

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Looks like no one’s replied in a while. To start the conversation again, simply

ask a new question.

i can’t seem to record my screen, can some one help me fix it ?? apple service help.

iPhone XR

Posted on Dec 29, 2018 1:18 PM

2 replies


Question marked as

Helpful

Jan 1, 2019 2:29 AM in response to Moozito

thats to much to do all these steps, i had this issue after the last software update the 12.1.2 never had this issue before. yesterday i was ****** off because i lost 3 important screen records i hope u guys solve it.


Question marked as

Helpful

Jan 1, 2019 3:06 AM in response to Mustafa_Abbas

Most likely one is not enough storage. Check your recently deleted images are cleaned out.

3 replies

Dec 31, 2018 7:58 AM in response to irfan160

Hey there, irfan160,

Thanks for stopping by the Apple Support Communities. If I understand your post, you’re trying to record your screen on your iPhone, but get an error message that the recording couldn’t save, with the error Cocoa error -1. I’m happy to help!

There are a few reasons your screen recording may not be able to save. To help determine what is going on, I’d recommend first checking the storage on your iPhone, and making space as needed: How to check the storage on your iPhone, iPad, and iPod touch — Apple Support.

If there is enough space but you still are unable to save the screen recording, try recording a different app to see if the issue is app-specific. If not, I would next recommend force closing all open apps: How to force an app to close on your iPhone, iPad, or iPod touch — Apple Support then restarting your iPhone: Restart your iPhone, iPad, or iPod touch — Apple Support.

After restarting, check to see if you are able to record your screen. Move onto the following steps if you still need help. Test the screen recording after each step, stopping when the issue is resolved:

  1. Check for, and install, any iOS updates available for your device: Update your iPhone, iPad, or iPod touch — Apple Support.
  2. Backup your iPhone: How to back up your iPhone, iPad, and iPod touch — Apple Support, then reinstall the iOS software using the «Reinstall iOS» section of If you see the Connect to iTunes screen on your iPhone, iPad, or iPod touch — Apple Support.
  3. Restore your iPhone to factory settings, and then set it up as a new device (meaning without restoring the backup you made in the previous step, at least temporarily): Restore your iPhone, iPad, or iPod to factory settings — Apple Support.

Have a wonderful day!


Question marked as

Helpful

Jan 1, 2019 2:29 AM in response to Moozito

thats to much to do all these steps, i had this issue after the last software update the 12.1.2 never had this issue before. yesterday i was ****** off because i lost 3 important screen records i hope u guys solve it.


Question marked as

Helpful

Jan 1, 2019 3:06 AM in response to Mustafa_Abbas

Most likely one is not enough storage. Check your recently deleted images are cleaned out.

cocoa error -1

Cocoa error 1 (Cocoa error -1) is a screen recording error that occurs in iOS and Mac devices. Mostly, users face this error code when they try to save the screen recording. Therefore, it is also known as Cocoa error -1 exporting.

Cocoa error 1 (main image)

This error code doesn’t look severe, but users have lost important data because of this error code as it prevents the users from saving the screen recording. Therefore, let’s fix this error code.

However, before fixing this error code, we have to understand this error code completely because this error has some variations.

Variation of Cocoa error 1

Contents

  • Variations of Cocoa Error -1 in iPhone
  • Variations of Cocoa Error -1 in macOS
  • What Causes the Cocoa Error 1 Issue?
  • How to Fix this Error Message?
    • Tip 1: Checking the Storage
    • Tip 2: Checking Whether an Update is Available or Not
    • 1. Turning Off the Low-Power Mode
    • 2. Restarting the iOS Device
    • 3. Creating a New Photos Library
  • Conclusion

Variations of Cocoa Error -1 in iPhone

So far, we have mentioned a general concept about Cocoa error 1. But apart from that, users have faced this error code in several other situations. So, let’s see those.

  • Several iPhone users have faced this error code while trying to do screen recording or trying to save the screen recording. In these cases, the users have reported that their iPhone devices are running on iOS 12.
  • Users have faced this error code after updating the software of their iOS device to version 12.1.2. Since then, those users are constantly reporting the occurrence of this error code upon trying to save the screen recording.
  • Sometimes users have faced this error code while taking a screenshot on iPhone 7.
  • When using some third-party application for screen recording and trying to save that screen recording in the Photos application, then users have faced this error code.
    Cocoa error 1 (iPhone-use case image)
  • Sometimes users have faced the issue while trying to combine multiple images to 1.
  • Users have also reported this error code with the customized functionality of a shortcut using the Shortcuts application. For example, creating a shortcut to find videos shorter than 10 seconds and putting them into an album that already exists. However, upon running, users get the cocoa error -1 message.
  • In some cases, users have reported the issue while trying to transfer the images from iPhone 7 to iPad.
  • Users have also reported this error code while grabbing the picture from SMS.
    Getting Cocoa error -1 on grabbing the picture from SMS
  • Sometimes, users have reported this error code while trying to save a picture on iPad mini-2.

Variations of Cocoa Error -1 in macOS

Apart from this error only occurring in iPhones, several macOS users have also reported this error code.

  • macOS users have faced this error code on the new 13-inch MacBook Pro with an M1 chipset running macOS 10.15. Here, the issue occurs while trying to access the images in the Photos app.
  • In some cases, when iMac users move all of their pictures to the NAS (Network-Attached Storage) folder, everything works fine upon looking at the individual pictures. But the shared albums are partially populated. So, when they try to import an individual picture, they face the error message.
  • Sometimes the issue also occurs after storing the Photos library on a locally connected USB drive with a WD Thunderbolt Duo. Here, the users have formatted the USB drive as HFS+J.
  • Users have also reported this error code while trying to import something from a PC to an iPhone 8 and iPhone 7.

These are all the use cases regarding the cocoa error 1 issue. Now, let’s see the reasons for the occurrence of this error code.

What Causes the Cocoa Error 1 Issue?

-1 is Apple’s way of saying that a particular error code is unidentified. However, according to our ballpark guesses, one of the following can be the reason for the occurrence of this issue.

  • The most common reason for the occurrence of this error code is low available storage for saving the screen recording.
  • If you’ve faced this error code while screen recording, then sometimes, this error code is specific to the recording of a particular application. So, check if that is the issue in your case or not.
  • Sometimes, this error code occurs while trying to record some protected or copyrighted content. For example, trying to screen record a Netflix movie.
  • As you know, iOS devices come with built-in screen recording software. So, using a third-party software application for screen recording can be the reason for the occurrence of this error code.
  • If you’ve faced this error code on a Mac system, then a damaged photo library can be the reason for the occurrence of this error code.
  • In rare cases, the low battery mode of the iOS can also cause this error code.

How to Fix this Error Message?

Tip 1: Checking the Storage

Before you want to try any complex solutions to this error code, you should check whether your iOS/macOS device has enough storage or not. Because sometimes, when the device can’t find a suitable amount of space for saving a screen recording file, then that device shows this error code.

  1. First, you’ll go to the ‘Settings’ application for your iOS device.
  2. Then, you’ll choose the ‘General’ option in the list of available Settings options.
    Choosing the 'General' option inside the 'Settings' options' list
    Choosing the ‘General’ option inside the ‘Settings’ options’ list
  3. Inside the ‘General’ settings window, you’ll choose the ‘iPhone Storage’ option.
    Choosing the 'iPhone Storage' option inside the 'General' window
    Choosing the ‘iPhone Storage’ option inside the ‘General’ window 
  4. In the next window, you can see your iPhone storage.
    iPhone storage stats

Note: If your storage is low, then you should consider clearing your storage before trying the screen recording again

However, if this scenario doesn’t relate to your use case, then try the next bonus tips and solutions.

Tip 2: Checking Whether an Update is Available or Not

As the issues like cocoa error 1 are mostly software glitches, therefore, Apple generally resolves such issues in the next stable updates. So, check whether your device has a stable update available or not. If yes, then update your device to the latest stable version and check if this fixes the issue or not.

  1. First, you’ll ‘follow the first two steps of Tip # 1, to go inside the ‘General’ settings window.
  2. Then, you’ll choose the ‘Software Update’ option.
    Software update - iPhone settings
    Software update – iPhone settings
  3. In the next window, you can see your current iOS version. Plus, you should also make the ‘Automatic Updates’ option to ‘On’ because this way, your device will automatically download the latest update when available and connected to the network.
    Enabling Automatic Updates
    Enabling Automatic Updates

However, if the update is not available or updating the device hasn’t resolved your issue, then try the main solutions.

1. Turning Off the Low-Power Mode

Low-Power Mode is one of Apple’s highlighted features on iOS devices. Apple automatically offers to turn it on when the battery of the device hits 20%. So, if that is your case, then turning it off can fix this error code.

  1. First, you’ll check whether the battery icon in the status bar of your iOS device is yellow or not. If yes, then this shows that the iOS device is in the Low-Power Mode.
    An indication that the Low-Power Mode is turned on

Note: If you’re not seeing a yellow battery icon, then that is not your case. Try any other solution

  1. So, you’ll navigate to the ‘Settings’ app of your iOS device.
  2. Then, you’ll choose the ‘Battery’ option from the list of Settings’ options.
    Battery settings - iPhone
    Battery settings – iPhone
  3. On the next screen, you’ll turn off the notch against the ‘Low-Power Mode’ option.
    Turning off Low Power Mode - iPhone
    Turning off Low Power Mode – iPhone

Note: You can also use Siri for turning off the Low-Power Mode. For example, you can say something like, ‘Hey Siri, Turn Off the Low Power/Battery Mode’

Note: You can also plug in your device and charge. Here, the device will automatically turn off the Low-Power Mode when it’ll reach a suitable battery percentage

If this solution has resolved your issue, then good for you. Otherwise, try the next solution.

2. Restarting the iOS Device

Restarting Procedure for iPhone X, 11, or 12

  1. First, you’ll press and hold the ‘Power’ and ‘Volume’ buttons until the power-off slider appears.
    Pressing and holding the ‘Power’ and ‘Volume-Down’ buttons for turning off iPhone X, 11 and 12
  2. Then, you’ll drag the slider and wait for 30 seconds to power off the device.
  3. Lastly, you’ll turn on the device again by pressing and holding the ‘Power’ button until you see the Apple logo.
    Pressing and holding the ‘Power’ button for turning on iPhone X, 11 and 12

Restarting Procedure for iPhone SE (2nd generation), 8, 7, or 6

  1. First, you’ll press and hold the ‘Power’ button until the power-off slider appears.
    Pressing and holding the ‘Power’ button for turning off iPhone 8, 7 and 6
  2. Then, you’ll ‘follow the last two steps of Restarting Procedure for iPhone X, 11, or 12.

Restarting Procedure for iPhone SE (1st generation), 5, or earlier

  1. First, you’ll press and hold the ‘Power’ button at the top of the iPhone 5 or earlier until the power-off slider appears.
    Pressing and holding the ‘Power’ button for turning off iPhone 5, or earlier
  2. Then, you’ll ‘follow the last two steps of Restarting Procedure for iPhone X, 11, or 12.

3. Creating a New Photos Library

Specific to macOS Users

If you’re facing this error code in a macOS system while accessing your images in the Photos application, then creating a new Photos Library will fix your issue.

Note: Before trying any of the following steps, make sure that all of your pictures are in the iCloud. This is so you can easily recover them.

  1. First, you’ll create a new Photos Library on your macOS system in the ‘Pictures’ folder.
  2. Then, you’ll set the newly created library as the system library.

Note: Make sure that iCloud photos are enabled

  1. Lastly, your macOS system will automatically start downloading everything from the Photos Library in the iCloud to the newly created Photos Library.

Note: If your macOS system doesn’t have enough storage, then you should take a backup of your current Photos Library and delete it from your macOS system. This way, you’ll still have the previous version of Photos Library on your macOS system

  1. Now, you’ll open the Photos application, but while opening, you’ll hold down the option key and then click on the ‘Create New…’ button.
  2. Then, you’ll name it ‘Photos Library.photoslibrary’ and locate it in your ‘Pictures’ folder.
    Clicking on the ‘Create New…’ button for creating a new library
  3. After this, you’ll open the new library and then navigate into the ‘General’ tab of Photos Preference.
  4. Then, you’ll click on the ‘Use as System Photos Library’ option.
    Choosing the ‘General’ tab and clicking on the ‘Use as System Photos Library’ option
  5. Now, you’ll go into the ‘iCloud’ tab and you’ll set it up as the final screenshot. The control will start downloading everything from the iCloud to the new library.
    Choosing the ‘iCloud’ tab

Note: Your macOS system should have enough storage space for downloading all the pictures from iCloud

If you’re also stuck in a similar situation with your macOS system, then this solution will fix the issue. However, if you’re facing this issue with removable storage or NAS, then read the following scenarios.

  • An external drive must be formatted APFS or MacOS Extended (journaled) (preferred for spinning drives).
  • It must not be (or have been) used for the time machine.
  • It must have the ‘ignore ownership’ checkbox ticked.
  • It should not be on a memory stick, SD, or similar.
  • It must also not be a network drive because a direct connection is required, like a USB or Thunderbolt.
  • File sharing services such as iCloud Drive, Dropbox, OneDrive, etc. are not compatible with Photos libraries.

Conclusion

If any of the solutions didn’t work for your iOS device, reinstalling the iOS software with the help of the ‘Reinstall iOS’ section and factory resetting your iOS device is your last resort.

Ezoic

Photo of Talha Saeed

I am a BSCS graduate and a technology nerd who now loves working and writing about computers and other tech-related stuff. In my free time, I like watching Netflix and playing Cricket 22 and The Witcher 3 (Wild Hunt).

Hi,

Some of my users are experiencing synchronization issues when using the NSPersistentCloudKitContainer in CoreData.
My app is listening to any errors that occur during the synchronization with the NSPersistentCloudKitContainer.eventChangedNotification Notification.
Before I just got Cocoa-Errors 2 or 3 which indicate a bad network connection or something similar.
Now I received reports with a Cocoa-Error 134419. Does anyone know what this error code means?
Maybe someone from the Core Data team could have a look at this.

Thanks a lot,
Alexander

Accepted Reply

I reached out to the Apple Developer Technical support and used one of my TSIs.
I got a very nice reply explaining the error to me and I want to share my new learnings with everyone else here:

“Cocoa-Error 134419” is an internal error indicating that the Core Data CloudKit aborts the persistent history analysis because the activity was deferred by the system. That normally happens when the system determines that Core Data CloudKit is using too many resources. From the app perspective, it means the app has too much data to export.

Core Data CloudKit may continue the history analysis later and when the system allows, but before that, it can’t export data to CloudKit.

From a developer’s perspective, there is nothing you can do to prevent this (except not storing too much data in Core Data).
«There is no way from the app side that can impact the resource balancing on the system side.»

I hope this helps everyone who is coming across this issue themself.

Replies

I reached out to the Apple Developer Technical support and used one of my TSIs.
I got a very nice reply explaining the error to me and I want to share my new learnings with everyone else here:

“Cocoa-Error 134419” is an internal error indicating that the Core Data CloudKit aborts the persistent history analysis because the activity was deferred by the system. That normally happens when the system determines that Core Data CloudKit is using too many resources. From the app perspective, it means the app has too much data to export.

Core Data CloudKit may continue the history analysis later and when the system allows, but before that, it can’t export data to CloudKit.

From a developer’s perspective, there is nothing you can do to prevent this (except not storing too much data in Core Data).
«There is no way from the app side that can impact the resource balancing on the system side.»

I hope this helps everyone who is coming across this issue themself.

Hi,

Some of my users are experiencing synchronization issues when using the NSPersistentCloudKitContainer in CoreData.
My app is listening to any errors that occur during the synchronization with the NSPersistentCloudKitContainer.eventChangedNotification Notification.
Before I just got Cocoa-Errors 2 or 3 which indicate a bad network connection or something similar.
Now I received reports with a Cocoa-Error 134419. Does anyone know what this error code means?
Maybe someone from the Core Data team could have a look at this.

Thanks a lot,
Alexander

Accepted Reply

I reached out to the Apple Developer Technical support and used one of my TSIs.
I got a very nice reply explaining the error to me and I want to share my new learnings with everyone else here:

“Cocoa-Error 134419” is an internal error indicating that the Core Data CloudKit aborts the persistent history analysis because the activity was deferred by the system. That normally happens when the system determines that Core Data CloudKit is using too many resources. From the app perspective, it means the app has too much data to export.

Core Data CloudKit may continue the history analysis later and when the system allows, but before that, it can’t export data to CloudKit.

From a developer’s perspective, there is nothing you can do to prevent this (except not storing too much data in Core Data).
«There is no way from the app side that can impact the resource balancing on the system side.»

I hope this helps everyone who is coming across this issue themself.

Replies

I reached out to the Apple Developer Technical support and used one of my TSIs.
I got a very nice reply explaining the error to me and I want to share my new learnings with everyone else here:

“Cocoa-Error 134419” is an internal error indicating that the Core Data CloudKit aborts the persistent history analysis because the activity was deferred by the system. That normally happens when the system determines that Core Data CloudKit is using too many resources. From the app perspective, it means the app has too much data to export.

Core Data CloudKit may continue the history analysis later and when the system allows, but before that, it can’t export data to CloudKit.

From a developer’s perspective, there is nothing you can do to prevent this (except not storing too much data in Core Data).
«There is no way from the app side that can impact the resource balancing on the system side.»

I hope this helps everyone who is coming across this issue themself.

iPhone “Screen Recording failed to save Cocoa error -1.” on iOS 12.1 [Fix]

iPhone X/7 User
after iOS 12/iOS 12.1.2 update are unable to screen record. While trying to record iPhone
screen and screen recording fails and not saving and gives
(Cocoa error -1.) error. The issue started after iOS 12 upgrade. After completing
the screen recording the error show is

Screen Recording failed to
save due to:

The operation be completed.

(Cocoa error -1.)

The screen recording issue
started to happened out of nowhere, the screen feature was working normally for
few recording session but for next screen recording the Cocoa -1 error started
to occur. This is too annoying for some of the iPhone users as they might lose
important screen recording data. This does not seems to be low storage issue as
the iPhone haing 100 GB left are still getting such issues. The error in itself
is not clear for end customer of iPhone like one users stated the issue as: 

Oo

While recording
screen on my iphone XR software IOS 12.1.2 and I see cocoa error -1 what does
this mean?

How to fix Screen Recording
failed to save do to:
The operation
couldn’t be completed.
(Cocoa error -1.) on iOS 12.1.2/12.1.3

Fix 1: Turn off low
power saver mode

Some users reports that the screen
recording fails if you are doing it while iPhone is in low power battery mode. In
this case the screen recording can give
(Cocoa error -1.). Please
Turn off low battery mode Setting->Battery-> Turn off Low power mode.

Fix 2: Normal reboot

The screen recording failing issue can
be due to a software glitch in iOS. Generally a normal reboot to iPhone may fix
the issue for you. So please try to do a normal reboot to your iPhone and check
if the issue fixes or persists. But it is unlikely that the recording footage
will be saved in iPhone.

Fix 3: Update the iOS
As told the issue are generally software glitch and can be fixed by Apple in next releases of iOS. So It is always recommended to keep updating iOS version to latest to get a stable fix for the issue.

I’m trying to save a video file to photo library. I got the following code snippet working, but I’m getting weird cocoa error -1 when trying to save a video created using UIImages with text added programmatically.

What is causing PHPhotoLibrary error «The operation couldn’t be completed. (Cocoa error -1.)» when trying to save a video file?

happens if I modify the images like this:

let midX = image.size.width / 2.0
let imageWithText = image.textToImage(drawText: "Added text", inImage: image, atPoint: CGPoint(x: midX, y: 100))

I’m using this solution to add text: How do I add text to an image in iOS Swift?

func textToImage(drawText text: String, inImage image: UIImage, atPoint point: CGPoint) -> UIImage {
    let textColor = UIColor.white
    let textFont = UIFont(name: "Helvetica Bold", size: 12)!

    let scale = UIScreen.main.scale
    UIGraphicsBeginImageContextWithOptions(image.size, false, scale)

    let textFontAttributes = [
        NSAttributedStringKey.font: textFont,
        NSAttributedStringKey.foregroundColor: textColor,
        ] as [NSAttributedStringKey : Any]
    image.draw(in: CGRect(origin: CGPoint.zero, size: image.size))

    let rect = CGRect(origin: point, size: image.size)
    text.draw(in: rect, withAttributes: textFontAttributes)

    let newImage = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()

    return newImage!
 }

This code works as long as the image has not been altered by adding text:

PHPhotoLibrary.shared().performChanges({
                PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: fileURL)
            }) { saved, error in
                if saved {
                   print("Saved video")
                }else if error != nil
                {
                    //getting error -1 here
                    print ("error: (error!.localizedDescription)")
                }
            }

Привет, я пытаюсь сохранить загруженный файл mp4 в свою галерею.

Загрузка URL с помощью, downloadTask

В

func urlSession(_ session: URLSession,
                    downloadTask: URLSessionDownloadTask,
                    didFinishDownloadingTo location: URL){
}

Я получаю URL

file:///private/var/mobile/Containers/Data/Application/8D761DFE-C050-426D-B91C-61DE441FB496/Library/Caches/com.apple.nsurlsessiond/Downloads/com.te.dn/CFNetworkDownload_KFSYSW.tmp

Я создаю путь, используя,

let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)
        let documentDirectoryPath:String = path[0]
        let fileManager = FileManager()
        let destinationURLForFile = URL(fileURLWithPath: documentDirectoryPath.appendingFormat("/file1.mp4"))

if fileManager.fileExists(atPath: destinationURLForFile.path){

        }
        else{
            do {
                try fileManager.moveItem(at: location, to: destinationURLForFile)
                // show file

            }catch{
                print("An error occurred while moving file to destination url")
            }
        }

Я смог успешно переместить файл (без ошибок при перемещении).

Затем я пытаюсь сохранить файл, получаю ошибку

let url = URL(fileURLWithPath: destinationURLForFile.path)

Значение url:

file:///var/mobile/Containers/Data/Application/8DF0C849-56A1-42B3-A081-0C992D18F973/Documents/file1.mp4


        PHPhotoLibrary.shared().performChanges({
            PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url)
        }) { saved, error in
            if saved {
                let alertController = UIAlertController(title: "Your video was successfully saved", message: nil, preferredStyle: .alert)
                let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
                alertController.addAction(defaultAction)
                self.present(alertController, animated: true, completion: nil)
            }
            else
            {
                print(error?.localizedDescription ?? "f")
            }

        }

O / p: Ошибка: — The operation couldn’t be completed. (Cocoa error -1.)

1 ответ

Лучший ответ

Не удается сохранить видео из файла m3u8.

Но мы можем загрузить видео в автономном режиме, а также не можем перейти к видео в галерею.

Здесь код яблока HLSCatalog


0

Vineesh TP
21 Ноя 2018 в 19:29

Hello,

I’m trying to save an image to the camera roll alongside an edited version. The goal is to replicate the behavior of the iOS Camera app, when a color filter is selected: when you take a photo, the original photo is saved, alongside an edit with the filtered photo.

I can’t seem to get this to work using one PHAssetCreationRequest — as shown in the code below, the operation fails with «error The operation couldn’t be completed. (Cocoa error -1.)» and no further info as to what I’m doing wrong.

            PHPhotoLibrary.shared().performChanges({() -> Void in
                let creationRequest: PHAssetCreationRequest = PHAssetCreationRequest.forAsset()
                let creationOptions = PHAssetResourceCreationOptions()
                creationRequest.addResource(with: .photo, fileURL: editedImageURL, options: nil)
                creationRequest.addResource(with: .adjustmentBasePhoto, fileURL: imageURL, options: nil)
                creationRequest.addResource(with: .adjustmentData, data: "somedata".data(using: .ascii)!, options: creationOptions)
      
            }, completionHandler: { (success: Bool, error : Error?) -> Void in
                if !success {
                    NSLog("error (error?.localizedDescription ?? "unknown error")")
                }
          
            })

Thanks,

Sebastien

Accepted Reply

Replies

For what it’s worth, I’m seeing the same with drag and drop implementations (dragging a video from Photos over to our app).

Thanks @3zs, yes I looked at that example — it also calls the addResource method on PHAssetCreationRequest twice:

— using PHAssetResourceType.alternatePhoto for the DNG file

— using PHAssetResourceType.photo for the jpeg file

I’ve tried to the same approach, but I get the same «Cocoa error -1 error».

Note if I call the addResource method on PHAssetCreationRequest only once with the original or edited image, it works.

Just to clarify: I tried the same approach with two JPEG files (the original photo, and the ‘edited’ version) and it fails with cocoa error -1. If I try with a DNG and a JPEG as per your example, it works of course.

For those who might come across this thread in the future, here’s a code example in Swift demonstrating what @sseb974 was referring to above:

PHPhotoLibrary.shared().performChanges {
      let creationRequest = PHAssetCreationRequest.forAsset()
      creationRequest.addResource(with: .photo, data: myOriginalImageData, options: nil)
      let editingOutput = PHContentEditingOutput(placeholderForCreatedAsset: creationRequest.placeholderForCreatedAsset!)
      try! myRenderedJpegData.write(to: editingOutput.renderedContentURL, options: .atomic)
      creationRequest.contentEditingOutput = editingOutput
    } completionHandler: { (success: Bool, error: Error?) in
    }

Понравилась статья? Поделить с друзьями:
  • Coc nvim jedi error
  • Cobian backup zip error
  • Cobian backup hashed list of file names is invalid native error 00059
  • Coapi 2041 ncs expert ошибка
  • Coapi 2041 falscher sg codierindex ошибка ncs