0

My app is working fine in the simulator as well as in Device, but when I try to Archive it, it gives me the below error

/Users/name/Library/Developer/Xcode/DerivedData/project-evflmdkacjdwilgizgoamypzjjxl/Build/Intermediates.noindex/ArchiveIntermediates/project/IntermediateBuildFilesPath/project.build/Release-iphoneos/project.build/Script-1D225BD221CA46970001C206.sh: line 29: syntax error: unexpected end of file Command PhaseScriptExecution failed with a nonzero exit code

I have tried the below solutions.

  1. Pod Update (No Success)
  2. Cleared DerivedData (No Success)
  3. Tracked the script location and saw line 29, it's nothing there (Check screenshot) enter image description here

  4. Clean Project Folder and Build (No Success)

  5. Cocoa Pod Update (No Success)
  6. Quit and restart Xcode (No Success)
  7. Keychain -> lock "Login" -> Unlock "Login" (No Success)
  8. Shut down machine and restarted (No Success)

I tried what I found on the web but still, I am not able to resolve it.

Cœur
  • 37,241
  • 25
  • 195
  • 267
iDeveloper
  • 940
  • 1
  • 10
  • 45
  • 1
    Not enough detail. In the build tab, where the error message is displayed, there is an icon on the righthand side of the line that invoked the script that expands to show the entire run of the script. There is more details at the bottom of that expanded section which you need to provide. – trojanfoe Sep 20 '19 at 11:22
  • @trojanfoe there is nothing but only the runscript. Should I update my question with the runscript picture? – iDeveloper Sep 20 '19 at 11:30
  • There should be error messages generated from the run script which you can see in the Build Log if you expand the right line. If not then I don't know how you will find a solution. – trojanfoe Sep 20 '19 at 12:21
  • @trojanfoe This is the error "/Users/name/Library/Developer/Xcode/DerivedData/project-evflmdkacjdwilgizgoamypzjjxl/Build/Intermediates.noindex/ArchiveIntermediates/project/IntermediateBuildFilesPath/project.build/Release-iphoneos/project.build/Script-1D225BD221CA46970001C206.sh: line 29: syntax error: unexpected end of file Command PhaseScriptExecution failed with a nonzero exit code" when we expand it. – iDeveloper Sep 20 '19 at 12:23
  • OK, looks like that first `while do...` doesn't have a `done`! – trojanfoe Sep 20 '19 at 12:24
  • @trojanfoe Yes I figured it out. But even if I place a done at the bottom it doesn't work – iDeveloper Sep 20 '19 at 12:25
  • @trojanfoe any idea what's the fix? – iDeveloper Sep 20 '19 at 12:34
  • Well I think a `done` at the end should fix it, however it's probably the `find` piping through the `while` loop that's confusing it. Why not `files=$(find ...)` and then `for file in files` etc? Also why are you stripping out unused architectures? – trojanfoe Sep 20 '19 at 12:36
  • @trojanfoe I am unaware of this Run Script. I have uploaded like 12 builds till April and after a few updates I had to push the new version and this error came up. I have no idea about this script. – iDeveloper Sep 20 '19 at 12:38
  • Well there is clearly a missing `done` statement... But like I asked before, why are you doing it? Doesn't Apple do this stuff for you already as part of App Thinning? – trojanfoe Sep 20 '19 at 12:40
  • I didn't write that script. I have no idea how it came there. @trojanfoe should I delete it? – iDeveloper Sep 20 '19 at 12:41
  • I wouldn't delete it, just stop calling it and see what happens. – trojanfoe Sep 20 '19 at 12:45
  • I have unchecked both options, below the script. Still same error. :( – iDeveloper Sep 20 '19 at 12:47
  • What are those options? I don't think they stop the script from being invoked, you need to remove "task" from Build Phases tab that calls the script. – trojanfoe Sep 20 '19 at 12:48
  • The option are "Show environment variables in build log" and "Run Script only while running". Where is "Task"? I tried with removing the code from the script and it worked! But this is nt the right solution. – iDeveloper Sep 20 '19 at 12:51
  • It's the line in the *Build Phases* list. You can press `+` to add a new job/task and there is an `x` top right to delete one (from memory)? – trojanfoe Sep 20 '19 at 12:52
  • So should I delete? – iDeveloper Sep 20 '19 at 12:53
  • Yes, but that won't delete the script, so you should be able to put it back if it causes an issue. I assume you are using `git` so you can undo this change (I don't want to be responsible for breaking your code)? – trojanfoe Sep 20 '19 at 12:54
  • @trojanfoe Yes I am using git. I have backup, no issues. For now it's archiving. Thanks alot – iDeveloper Sep 20 '19 at 13:20

0 Answers0