Reputation: 169
I've been stuck on this problem since yesterday morning and I don't know what else to try. I am using Xcode 10, Swift 4.
Everything was ok, until I tried to use a real iPhone to test my app.
I needed to login on Mac id and I realized I created a kind of new certificate (I am new at it and I don’t know why is that). I realized also there was another expired certificate on key chain access that I deleted (from the previous developer).
I tried to run on the iPhone, Xcode asked me about keychain password, I tried to put the password from my Mac id and it wasn’t it. So I declined. All my problems started then.
First error was:
Command /bin/sh failed with exit code 1
So I tried to check “Run Script Only When Installing” at Build Phases.
The error changed to:
libswiftcore :-1: Failed with exit code 1
I tried to reset my password from keychain, unlock and lock it, but no success. Tried also to clean project, move to trash all DerivedData.
I tried to restart macbook and xcode also.
So I decided to update Xcode from 9.4 to 10.
Tried again, same error.
Ok, I gave up, I decided to use only simulators then.
I got a new error: `
dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire
So, I tried to add Alamofire framework at Target, Build Phases, Embedded Frameworks.
Every time I tried something different, I tried do clean project, build and run. Also restarting xcode, locking and unlocking keychain.
New and current error:
Copy Alamofire.framework 0.1 seconds
PBXCp /Users/myfolder/Library/Developer/Xcode/DerivedData/AppZap-epwtpkbsxrklbvdulvpzvgvgswoh/Build/Products/Debug-iphonesimulator/Alamofire.framework /Users/zapgrafica/Library/Developer/Xcode/DerivedData/AppZap-epwtpkbsxrklbvdulvpzvgvgswoh/Build/Products/Debug-iphonesimulator/AppZap.app/Frameworks/Alamofire.framework
cd /Projetos/Mobile/Ios/trunk/AppZap
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -exclude Headers -exclude PrivateHeaders -exclude Modules -exclude *.tbd -resolve-src-symlinks /Users/zapgrafica/Library/Developer/Xcode/DerivedData/AppZap-epwtpkbsxrklbvdulvpzvgvgswoh/Build/Products/Debug-iphonesimulator/Alamofire.framework /Users/zapgrafica/Library/Developer/Xcode/DerivedData/AppZap-epwtpkbsxrklbvdulvpzvgvgswoh/Build/Products/Debug-iphonesimulator/AppZap.app/Frameworks
error: /Users/myfolder/Library/Developer/Xcode/DerivedData/AppZap-epwtpkbsxrklbvdulvpzvgvgswoh/Build/Products/Debug-iphonesimulator/Alamofire.framework: No such file or directory
I have tried to uninstall pod, install and update. I tried to clean DerivedData also.
I am opening .xcworkspace not the .xcodeproj.
I have read almost 100 questions and answers from here.
The only thing I realized is that since the first time I declined keychain, I have never gotten the box from keychain with “Always Allow, Decline and Allow” anymore.
Could anyone help me please?
Upvotes: 4
Views: 11576
Reputation: 11
Only this solution worked for XCode 16.1:
Go to your project select General and remove AlamofireDynamic from this section by clicking on the minus icon as shown in the image below:
Upvotes: 1
Reputation: 11
Just need to select "No" for the "User Script Sandboxing" option under "Build Options".
Upvotes: 1
Reputation: 516
AlamofireDynamic
:In the Xcode project settings, go to your main project target, then Build phases, then Link with binary libraries section, and delete AlamofireDynamic with the - button.
Now mine built.
Also, to avoid this problem next time when you add Alamofire (if using SwiftPM) in the add package dependency popover, just don't add alamofire dynamic:
Upvotes: 19
Reputation: 2589
Search for source="$(readlink "${source}")" and replace it with:
# source="$(readlink "${source}")"
source="$(readlink -f "${source}")"
Upvotes: 3
Reputation: 3232
UPDATED
I used to have the same problem, yet didn't understood why it happened. As far as I know is a problem with your keychain. Try removing the certificate, change the bundle identifier and try it again.
mixed with your solution
Then, clean and run.
Upvotes: 3
Reputation: 3082
I got a new error: dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire.
You are on the correct way. Now you must embed Alamofire framework.
Go to project settings -> Select your target -> Build phases -> Embedded Frameworks -> Press + -> Add Alamofire as embedded framework.
Here is a Link to documentation on how to do it.
Upvotes: 0