I’m attempting to compile an OSX command line project with RxSwift. The project has nothing in it, except what is auto-generated by xcode. The RxAtomic framework can not be found at run time.
dyld: Library not loaded: @rpath/libswiftAppKit.dylib
Referenced from: /Users/user1/Library/Developer/Xcode/DerivedData/CommandLine_Project-bwkerycnadvzcsaxraloxwknylzq/Build/Products/Debug/RxSwift.framework/Versions/A/RxSwift
Reason: image not found
What is the correct way to configure this type of project? My Podfile is simple:
use_frameworks!
target ‘CommandLine_Project’ do
pod ‘RxSwift’, ‘4.4.0’
end
I am not sure what the prolem might be but have a look at the chapter on Schedulers - I remember the example project in that chapter is a command line tool so you might want to look into its setup to see if there is anything special to make it work.
I took the Podfile from the schedulers chapter and I only changed the target name to my project and otherwise left the Podfile identical. Then with nothing in my command line tool project but the default code, I ran the project and got the same error. This is why I am asking how to configure this type of project. The scheduler project works and mine does not. What am I missing?
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings[‘CONFIGURATION_BUILD_DIR’] = ‘$PODS_CONFIGURATION_BUILD_DIR’
end
end
end
The next question is, what does this code from the Podfile actually do to the project, because it is necessary to make the project run:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings[‘CONFIGURATION_BUILD_DIR’] = ‘$PODS_CONFIGURATION_BUILD_DIR’
end
end
end
ANSWER:
This code changes the value at:
Pods → Targets → RxAtomic(and RxSwift) → Build Settings → Per-configuration Build Products Path → Debug(and Release)
to
${PODS_CONFIGURATION_BUILD_DIR}
That’s it. It’s all “build settings” issues in various targets through the workspace.
Create a command line tool project in Xcode. I named mine “CLT”
Create and install this Podfile:
target ‘CLT’ do
use_frameworks!
pod ‘RxSwift’
end
import RxSwift in main.swift
run
crash: dyld: Library not loaded: @rpath/RxAtomic.framework/Versions/A/RxAtomic Referenced from: /Users/userXYZ/Library/Developer/Xcode/DerivedData/CLT-fcpegvkpwcnbgkahumvrvwssxqnk/Build/Products/Debug/CLT Reason: image not found
work around: in project CLT → Targets → CLT → Build Settings → Runpath Search Paths
add two entries:
‘@executable_path/RxAtomic’
‘@executable_path/RxSwift’ in Pods → Targets → RxSwift → Build Settings → Always Embed Swift Standard Libraries → YES