简体   繁体   English

无法使用Alamofire 4.1.0,Xcode 8和Swift 3构建项目-没有此类文件或目录

[英]Can't build project with Alamofire 4.1.0, Xcode 8, and Swift 3 - no such file or directory

I have an iOS project that I haven't updated in almost a year, but now I need to add a feature. 我有一个将近一年未更新的iOS项目,但是现在我需要添加一个功能。 After working through the normal headaches of having to update Swift (since I have updated Xcode in the meantime), I have one remaining problem that seems to have to do with Alamofire not wanting to build with the following error (no such file or directory): 在经历了不得不更新Swift的正常麻烦之后(由于我同时更新了Xcode),我还有一个剩余的问题似乎与Alamofire有关,它不希望生成以下错误(没有这样的文件或目录) :

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/David/Library/Developer/Xcode/DerivedData/Dealer_Dashboard-darqlvvgqwnvdybcswbtllluwvjw/Build/Intermediates/Dealer\ Dashboard.build/Debug-iphonesimulator/Dealer\ Dashboard.build/Script-210B7DE0B605AB4E3AA431FD.sh
    cd "/Users/David/Documents/TC-Dev/Dealer Dashboard"
    /bin/sh -c \"/Users/David/Library/Developer/Xcode/DerivedData/Dealer_Dashboard-darqlvvgqwnvdybcswbtllluwvjw/Build/Intermediates/Dealer\ Dashboard.build/Debug-iphonesimulator/Dealer\ Dashboard.build/Script-210B7DE0B605AB4E3AA431FD.sh\"

mkdir -p /Users/David/Library/Developer/Xcode/DerivedData/Dealer_Dashboard-darqlvvgqwnvdybcswbtllluwvjw/Build/Products/Debug-iphonesimulator/Dealer Dashboard.app/Frameworks
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/David/Library/Developer/Xcode/DerivedData/Dealer_Dashboard-darqlvvgqwnvdybcswbtllluwvjw/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework" "/Users/David/Library/Developer/Xcode/DerivedData/Dealer_Dashboard-darqlvvgqwnvdybcswbtllluwvjw/Build/Products/Debug-iphonesimulator/Dealer Dashboard.app/Frameworks"
building file list ... done

sent 196 bytes  received 20 bytes  432.00 bytes/sec
total size is 1965425  speedup is 9099.19
Code Signing /Users/David/Library/Developer/Xcode/DerivedData/Dealer_Dashboard-darqlvvgqwnvdybcswbtllluwvjw/Build/Products/Debug-iphonesimulator/Dealer Dashboard.app/Frameworks/Alamofire.framework with Identity -
/usr/bin/codesign --force --sign -  --preserve-metadata=identifier,entitlements /Users/David/Library/Developer/Xcode/DerivedData/Dealer_Dashboard-darqlvvgqwnvdybcswbtllluwvjw/Build/Products/Debug-iphonesimulator/Dealer Dashboard.app/Frameworks/Alamofire.framework
/Users/David/Library/Developer/Xcode/DerivedData/Dealer_Dashboard-darqlvvgqwnvdybcswbtllluwvjw/Build/Products/Debug-iphonesimulator/Dealer: No such file or directory

If I manually create the directory "Dealer", it gets past that error and I get a new one that is similar. 如果我手动创建目录“经销商”,它会越过该错误,并且会得到一个类似的新目录。 My project is named "Dealer Dashboard" (with a space), and as you may notice, this and all of the other failing paths seem to get truncated at the space, so I did a search and found this issue, which seems to have been resolved over a year ago (but maybe it resurfaced in this version?) https://github.com/CocoaPods/CocoaPods/issues/3754 It looks like it's creating a valid directory, but then trying to sign code that's in an invalid/truncated version of that directory. 我的项目名为“ Dealer Dashboard”(带有空格),您可能会注意到,该路径和所有其他失败的路径似乎都在该空间处被截断,因此我进行了搜索,发现了这个问题,一年多以前已解决(但可能在此版本中重新出现了吗?) https://github.com/CocoaPods/CocoaPods/issues/3754看起来它正在创建一个有效目录,但随后尝试对无效代码进行签名该目录的/截断版本。 Everything worked fine when I was working with Swift 2.2 and an older version of Alamofire. 当我使用Swift 2.2和旧版本的Alamofire时,一切工作正常。

What I have tried: I have updated Xcode as of today, I have updated CocoaPods to version 1.2.0.beta.1 and removed all other versions, I have updated my podfile and run pod setup and pod update and I am now on Alamofire 4.1.0 and SwiftyJSON 3.0.0 (according to podfile.lock). 我尝试过的工作:到目前为止,我已经更新了Xcode,我已经将CocoaPods更新到了1.2.0.beta.1版本,并删除了所有其他版本,我已经更新了自己的podfile并运行pod设置和pod更新,现在我在Alamofire上4.1.0和SwiftyJSON 3.0.0(根据podfile.lock)。 I have deleted everything from DerivedData multiple times and emptied the trash and cleaned the solution and restarted Xcode and the computer in various orders, and have not had any luck. 我已经多次从DerivedData中删除了所有内容,清空了垃圾箱并清理了解决方案,然后以各种顺序重新启动了Xcode和计算机,但没有任何运气。 I have seen many other links to similar problems, but none of the answers seem to work in my case. 我已经看到许多其他与类似问题有关的链接,但在我看来,所有答案都没有用。

Is this a bug in AlamoFire related to the space in my project name, or can somebody else recommend something to try? 这是AlamoFire中的错误与我的项目名称中的空间有关吗,还是其他人可以推荐一些尝试的方法? If it is a bug, the link I posted recommends a "sneaky" workaround that links to a huge podfile, but 98% of my development time is spent in Windows and .Net, and I cannot see through all of the unrelated code and settings to figure out what they are really trying to get me to do... it looks like it has to do with "def predictabilize_uuids", but I have no idea what that means or does, or which lines of code I need to move over to my project to implement it. 如果它是一个错误,我发布的链接建议使用一个“偷偷摸摸的”变通方法来链接到一个巨大的podfile,但是我98%的开发时间都花在Windows和.Net上,而且我看不到所有不相关的代码和设置弄清楚他们真正想让我做什么……看起来与“ defpredictabilize_uuids”有关,但是我不知道这意味着什么或做什么,或者我需要移到哪几行代码我的项目来实施它。 I suspect that I am too late to rename my project so that it doesn't contain a space, since it's already in the App Store and I need to push this as an update, so I need to find a solution or workaround. 我怀疑现在为我的项目重命名为时已晚,因为它不包含空格,因为它已经存在于App Store中,因此我需要将其作为更新进行推送,因此我需要找到解决方案或解决方法。 Any help would be appreciated! 任何帮助,将不胜感激!

One of the comments by freak4pc in this post helped me: https://github.com/CocoaPods/CocoaPods/issues/3754 这篇文章中freak4pc的评论之一对我有所帮助: https : //github.com/CocoaPods/CocoaPods/issues/3754

In the file tree in Xcode, expand "Pods", expand "Targets Support Files", expand "Pods-[Project Name]", and edit "Pods-[Project Name]-frameworks.sh. Look for the section that deals with framework signing. change the following line: 在Xcode的文件树中,依次展开“ Pods”,“目标支持文件”,“ Pods- [项目名称]”和“ Pods- [项目名称] -frameworks.sh”。框架签名,更改以下行:

local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1""

to this: (add single quotes around the "$1" at the end) 为此:(在末尾的“ $ 1”周围添加单引号)

local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '"$1"'"

Clean the project and build again - in my case it worked as expected. 清理项目并重新构建-就我而言,它按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM