# CopyFileTo fails without error (2018r3/Mojave)

**URL:** <https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963>\
**Category:** macOS\
**Created:** [March 30, 2019, 5:39pm UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963 "2019-03-30T17:39:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stéphane\_Mons](https://forum.xojo.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@Stéphane\_Mons](https://forum.xojo.com/u/St%C3%A9phane_Mons)\
**Post date:** [March 30, 2019, 5:39pm UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963/1 "2019-03-30T17:39:03Z")

</div>

Hi all. I am trying to copy a file from within the Photos Library to another folder in my user’s directory using CopyFileTo.

At first I got error -54 (permission error while reading), even though I can copy that file within the Finder, then the error disappeared. I do no longer get an error, but the file is never copied.

Have you ever encountered such a problem?

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [March 30, 2019, 5:44pm UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963/2 "2019-03-30T17:44:40Z")

</div>

Does your app have (or maybe need?) a Photos entitlement? How exactly are you getting at this file? The Photos library would probably respond better to being used through an API than directly accessing the files.

---

<div class="post-metadata">

**Author:** ![Stéphane\_Mons](https://forum.xojo.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@Stéphane\_Mons](https://forum.xojo.com/u/St%C3%A9phane_Mons)\
**Post date:** [March 30, 2019, 5:57pm UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963/3 "2019-03-30T17:57:06Z")

</div>

@Tim Parnell  That is an interesting point, thank you. I just moved to Mojave (and against my will) from Sierra and I am absolutely not accustomed to this new level of paranoia (or should I say security?).

But how can I add entitlements to a Xojo project in debug mode?

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [March 30, 2019, 6:26pm UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963/4 "2019-03-30T18:26:35Z")

</div>

You are running into the protection of Full Disk Access. And yes, it’s paranoia.

You need to sign the app. I did some experimentation a couple of weeks ago. And forgot to note down the exact steps. You need to have a signed version, allow full disk access, then you can start the signed debug version or something similar.

---

<div class="post-metadata">

**Author:** ![Jürg\_Otter](https://forum.xojo.com/user_avatar/forum.xojo.com/j%C3%BCrg_otter/32/584_2.png) [@Jürg\_Otter](https://forum.xojo.com/u/J%C3%BCrg_Otter)\
**Post date:** [March 30, 2019, 7:19pm UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963/5 "2019-03-30T19:19:20Z")

</div>

If you want to pick a Photo from the Photos Library using an OpenDialog, you need to add a [NSPhotoLibraryUsageDescription](https://forum.xojo.com/conversation/post/423624). The [linked Forum Post](https://forum.xojo.com/conversation/post/423624) explains how that needs to be done.

> [@431009:@Beatrix Willius](#):
>
> You are running into the protection of Full Disk Access.

However, if you just try to access files in the Photos Library without the user having explicitly selected something using an OpenDialog… then yes: your application might even need Full Disk Access.  
I’m quite sure there is a Forum Thread about this - I just can’t find it right now…

---

<div class="post-metadata">

**Author:** ![Sam\_Rowlands](https://forum.xojo.com/user_avatar/forum.xojo.com/sam_rowlands/32/265_2.png) [@Sam\_Rowlands](https://forum.xojo.com/u/Sam_Rowlands)\
**Post date:** [March 31, 2019, 12:46am UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963/6 "2019-03-31T00:46:07Z")

</div>

> [@431007:@StphaneMons](#):
>
> But how can I add entitlements to a Xojo project in debug mode?

Are you using App Wrapper? If so check the help on Xojo integration.

You can also use the NSMediaLibraryBrowser ([https://www.ohanaware.com/xojo/NSMediaLibraryBrowser.zip](https://www.ohanaware.com/xojo/NSMediaLibraryBrowser.zip)), when using this on Mojave, I never once got asked if I wanted to allow my application to access the Photos library.

---

<div class="post-metadata">

**Author:** ![Stéphane\_Mons](https://forum.xojo.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@Stéphane\_Mons](https://forum.xojo.com/u/St%C3%A9phane_Mons)\
**Post date:** [April 1, 2019, 11:47am UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963/7 "2019-04-01T11:47:38Z")

</div>

Thank you Jürg, Sam, Beatrix and Tim.Your answers made me learn a lot.

I was focused on accessing my photos library and the macOS dialog to allow such access actually uses both the term “photos” and the Photos app’s icon, with added to my confusion. In fact, it was all about granting access to the Pictures folder instead of the photos library itself.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 7:36pm UTC](https://forum.xojo.com/t/copyfileto-fails-without-error-2018r3-mojave/47963/8 "2020-10-29T19:36:23Z")

</div>


