我创建了一个使用 RMSharedPreferences 框架的 Mac 应用程序。当打开应用程序时,它立即崩溃,并出现以下错误:
Dyld Error Message:
Library not loaded: @rpath/RMSharedPreferences.framework/Versions/A/RMSharedPreferences
Referenced from: /Users/USER/Desktop/MyApp.app/Contents/MacOS/MyApp
Reason: image not found
似乎找不到框架。我尝试将复制文件阶段添加到目标中,应该会复制框架,当在Finder中浏览应用程序内容时,它看起来被正确复制了。
有人知道是什么原因导致出现此错误吗?
编辑:将框架设置为可选确实可以使应用程序启动而没有任何错误,但是应用程序无法正常工作。所有RMSharedPreferences相关的调用都会被忽略。
@executable_path/../Frameworks
解决了问题。非常感谢您的回答和对苹果文档的参考。 - simonbs