# Packaging for iOS fails with "Cannot create because a file with the same name already exists."

**URL:** <https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520>\
**Category:** Platform & Builds\
**Tags:** error, MAC, unreal-engine, iOS, Packaging, build-failed, question\
**Created:** [February 5, 2016, 4:53pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520 "2016-02-05T16:53:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 5, 2016, 4:53pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/1 "2016-02-05T16:53:37Z")

</div>

I recently have issues packaging for iOS (and tvOS) on Mac. I use UE4Editor/Mac/Development built from latest 4.11 branch to package my game for iOS/Development. All goes well except in the end I get a message that it `Cannot create /Volumes/Dev/UnrealEngine/4.11/Projects/SkookumDemo/Binaries/IOS/Payload/SkookumDemo.app/SkookumDemo because a file with the same name already exists.`. I checked and indeed there is a file already named like that (the executable). Any clues why this is happening?

Full log text below:

```
MainFrameActions: Packaging (iOS): Project.Package: **********PACKAGE COMMAND STARTED**********
MainFrameActions: Packaging (iOS): IOSPlatform.Package: Package /Volumes/Dev/UnrealEngine/4.11/Projects/SkookumDemo/SkookumDemo.uproject
MainFrameActions: Packaging (iOS): Getting IOS Deploy()
MainFrameActions: Packaging (iOS): Program.Main: ERROR: AutomationTool terminated with exception: System.IO.IOException: Cannot create /Volumes/Dev/UnrealEngine/4.11/Projects/SkookumDemo/Binaries/IOS/Payload/SkookumDemo.app/SkookumDemo because a file with the same name already exists.
MainFrameActions: Packaging (iOS): at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
MainFrameActions: Packaging (iOS): at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
MainFrameActions: Packaging (iOS): at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at IOSPlatform.Package (AutomationTool.ProjectParams Params, DeploymentContext SC, Int32 WorkingCL) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at Project.Package (AutomationTool.ProjectParams Params, Int32 WorkingCL) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at BuildCookRun.DoBuildCookRun (AutomationTool.ProjectParams Params) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at BuildCookRun.ExecuteBuild () [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at AutomationTool.BuildCommand.Execute () [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at AutomationTool.Automation.Execute (System.Collections.Generic.List`1 CommandsToExecute, Tools.DotNETCommon.CaselessDictionary.CaselessDictionary`1 Commands) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at AutomationTool.Automation.Process (System.String[] CommandLine) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at AutomationTool.Program.MainProc (System.Object Param) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at AutomationTool.InternalUtils.RunSingleInstance (System.Func`2 Main, System.Object Param) [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): at AutomationTool.Program.Main () [0x00000] in <filename unknown>:0 
MainFrameActions: Packaging (iOS): Program.Main: AutomationTool exiting with ExitCode=1 (Error_Unknown)
MainFrameActions: Packaging (iOS): Domain_ProcessExit
MainFrameActions: Packaging (iOS): RunUAT ERROR: AutomationTool was unable to run successfully.

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [February 8, 2016, 5:56pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/2 "2016-02-08T17:56:08Z")

</div>

Hi GreatGuru,

You cannot have a directory with the same name as the executable. Change the name of one and retry. Let me know if this does not work for you.

-.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 8, 2016, 6:49pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/3 "2016-02-08T18:49:32Z")

</div>

Hmm both the folder and the executable name come from the build process as far as I know, presumably both reflecting the project name, SkookumDemo. I did not choose these names. How do you suggest I go about changing them? I could try renaming the project see if that helps I guess.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [February 8, 2016, 9:18pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/4 "2016-02-08T21:18:47Z")

</div>

Using the project you sent, SkookumDemo 4.11 3, I was able to launch successfully to a folder on the Desktop called “TestPackage” for both Mac and iOS without issue. Please try this and/or renaming the project and let us know your results.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 10, 2016, 9:35pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/5 "2016-02-10T21:35:16Z")

</div>

~~So - renaming the project file from to `SkookumDemo.uproject` to `SkookumDemo2.uproject` fixes the issue.~~ I take it back, renaming the project file does _not_ fix the issue. I renamed the project to all sorts of names, and just get the same message just with the word `SkookumDemo` replaced with the new project name. I am using UE4Editor on Mac and I “Package” for iOS.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 11, 2016, 7:02am UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/6 "2016-02-11T07:02:37Z")

</div>

Ok this looks like a bug related to the staging of additional NonUFS files. Seems like the folder hierarchy of staged files was changed between 4.10 and 4.11. You are not seeing the issue because you probably don’t have SkookumScript installed and never generated SkookumScript binary files that are packaged with the excutable, exposing this problem. Try to reproduce this (on Mac):

1. In the SkookumDemo project, verify that there is an entry in the `Config/DefaultGame.ini` file

2. Now, in the project’s `Content` folder, create a subfolder `skookumscript`, and inside that folder place a random file, e.g. a text file `test.txt` containing the string “Hello World”.

3. Try to package the project for iOS, see if you get my error. What _should_ happen here is that the `skookumscript` folder with the test file will be placed in the staged package inside the `cookeddata/content` folder. Instead it creates a folder `SkookumDemo/content` right beside `cookeddata` and places the `skookumscript` folder there. This then causes the naming conflict with the executable.

Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [February 11, 2016, 3:37pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/7 "2016-02-11T15:37:02Z")

</div>

I cannot install SkookumScript… I get an error saying not compatible with this version of the Engine. I see the plugin is for UE4.11 preview 4, and everyone on the support team has updated to preview 5.

So do you have a preview 5 version of the plug-in available? If not, I may be able to find a workaround or someone who has not updated yet.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 11, 2016, 3:53pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/8 "2016-02-11T15:53:51Z")

</div>

Have you tried the three steps above? They don’t require SkookumScript and should still cause the error to occur. We will post a pre-built plugin for 4.11p5 soon as well.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [February 11, 2016, 7:17pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/9 "2016-02-11T19:17:32Z")

</div>

After following the first 2 steps I cannot open the project to perform step 3. However, while researching I discovered a similar bug that started in Preview 4 and is fixed in Preview 5. Please download preview 5 and see if this issue persists.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [February 11, 2016, 8:51pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/10 "2016-02-11T20:51:54Z")

</div>

I missed your note before about opening on a Mac and was trying to open the Windows version. After following your steps on a Mac, the issue did not occur for 4.11Preview5, resulting in a successful package “SkookumDemo.ipa”

Your test file resides in: …SkookemDemo 4.11 3\>Saved\>StageBuilds\>IOS\>SkookumDemo\>Content\>skookumscript\>test.rtf

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 11, 2016, 9:04pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/11 "2016-02-11T21:04:00Z")

</div>

If the folder `Saved/StagedBuilds/iOS` contains a folder `SkookumDemo` that would collide with the executable also named `SkookumDemo` which would be packaged at the same folder level. Also the content folder being mounted by the runtime file system is `cookeddata` and not `SkookumDemo` so `test.rtf` would not be found. Two problems right there. The folder 'skookumscript`comes from the project's`Content`folder and has to end up in the package's content folder right beside the`paks`folder but obviously doesn't. Have you verified the ipa file that it contains in its`Payload/SkookumDemo.app`folder both your`test.rtf`in`SkookumDemo/Content/skookumscript`and the executable`SkookumDemo`? If so that is a conflict constituting essentially a corrupt archive. Try extracting the archive - do you get an error message? If not, does the extracted data contain both the excutable `SkookumDemo`and`test.rtf`?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 11, 2016, 9:38pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/12 "2016-02-11T21:38:50Z")

</div>

Also please try packaging the same project for Win64 you’ll see the folder structure is different = what it’s supposed to be. The `skookumscript` folder ends up next to the `Paks` folder where it belongs. Also works fine on Android btw. Just on iOS and tVOS it doesn’t. That is a bug.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 16, 2016, 8:38pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/13 "2016-02-16T20:38:19Z")

</div>

Hi - any update on this? Were you able to reproduce it?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [February 16, 2016, 9:37pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/14 "2016-02-16T21:37:17Z")

</div>

We are still looking at this and I should have more definitive information for you by noon tomorrow. In the meantime, have you tried updating to 4.11 preview 5?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [February 17, 2016, 10:11pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/15 "2016-02-17T22:11:56Z")

</div>

Had some technical issues on the Mac that set me back. But following your steps from scratch, I came up with the exact same results as before: No packaging errors, successfully creating an ipa file. Wasn’t the initial issue that you were not able to create an ipa file successfully because you were getting the error: “Cannot create because a file with the same name already exists?”

Have you tried updating to preview 5 and setting your output to a different directory as troubleshooting steps? Are you able to create an ipa at all or does packaging fail when you get the error message? Please provide this information.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 17, 2016, 10:17pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/16 "2016-02-17T22:17:59Z")

</div>

Hi - Yes my original issue was that packaging failed but the underlying problem is that folders specified using `+DirectoriesToAlwaysStageAsNonUFS=` will get archived incorrectly. This may or may not result in an error during packaging apparently. The folder `skookumscript` has to end up in the same content folder as the Paks and it’s not. Did you try unpacking the ipa as I suggested?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 18, 2016, 1:52am UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/17 "2016-02-18T01:52:43Z")

</div>

I have updated to 4.11p5 long ago. I tried both packaging with 4.11p5 and with latest 4.11 built from source. Both report an error that all my provisioning profiles are not valid (which they are, and they are not expired, and I have used them many times before). If I proceed anyway, 4.11p5 will fail with a code signing error, and 4.11 built from source will again fail with the error I started this thread on (Cannot create /Volumes/Dev/UnrealEngine/4.11/Projects/SkookumDemo/Binaries/IOS/Payload/SkookumDemo.app/SkookumDemo because a file with the same name already exists.). The `Saved/StageBuilds` folder - again - contains the wrong folder structure as described many times.  
Can you please try to unpack your ipa? You will see that it is no good because either the executable or the test text file will be missing.

---

<div class="post-metadata">

**Author:** ![Ravlek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ravlek](https://forums.unrealengine.com/u/Ravlek)\
**Post date:** [February 18, 2016, 4:57pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/18 "2016-02-18T16:57:04Z")

</div>

So, the provisioning profile issue is that the Apple World Wide Authority certificate expired. Go to [Apple PKI - Apple](https://www.apple.com/certificateauthority/) and download the WWDR certificate that expires in 2023. Double click it and import it to the System keychain, if you haven’t already. The old one expired last Sunday, so that is relatively recent development. As for the StageAsNonUFS, I’ll have a look today. It’s possible something has changed in the last few months since 4.11 and 4.10 were similar which is causing this error.

-Pete

---

<div class="post-metadata">

**Author:** ![Ravlek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ravlek](https://forums.unrealengine.com/u/Ravlek)\
**Post date:** [February 18, 2016, 5:04pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/19 "2016-02-18T17:04:17Z")

</div>

I already see the issue. So that we don’t collide with the executable name, all content is put in cookeddata/gamename. However, the code to copy the NonUFS data is not taking that into account for iOS, so it is putting in the root which collides with the executable. I’ll look into a fix today.

-Pete

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a00f2bd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a00f2bd](https://forums.unrealengine.com/u/anonymous_user_0a00f2bd)\
**Post date:** [February 18, 2016, 5:59pm UTC](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520/20 "2016-02-18T17:59:24Z")

</div>

Thanks Pete - so I did this, generated new certificates and provisioning profiles but also had to delete the old WWDR certificate from both System and Login keychain for the Keychain to be happy. Unfortunately, now I am getting an error that the bundle identifier “com.YourCompany.[PROJECT\_NAME]” does not match my provision profile. Makes sense, so I fixed that in the project settings and set it to “com.agoglabs.[PROJECT\_NAME]” which matches the “com.agoglabs.\*” of the profile, and confirmed that it is correctly set in DefaultEngine.ini. However I keep getting the error despite fixing this. It continues to claim that my bundle identifier is “com.YourCompany.[PROJECT\_NAME]” when it’s not. Tried deleting cooked and staged data but still getting this. Any insight into this would be helpful.

[Next page](https://forums.unrealengine.com/t/packaging-for-ios-fails-with-cannot-create-because-a-file-with-the-same-name-already-exists/346520.md?page=2)
