我在Xcode 8.2.1上开发了一个应用程序,它使用了Swive3。我有一些异步任务需要按照适当的顺序排列,因此我决定为此目的使用PromiseKit。我向我的项目目录中添加了一个podfile,并修改了它,然后使用pod install (通过cocoapods)安装它。安装工作正常,因为我的命令行给了我这个成功的消息:

(顺便说一句,这是podfile文本):

我将框架添加到项目的链接框架和库中,如下所示:

完成所有这些工作后,我希望能够利用位于viewControllers顶部的viewControllers来访问框架库中的函数。但是,键入import PromiseKit会导致以下错误:

有谁知道问题可能是什么吗?
发布于 2017-03-05 07:33:42
因此,这一特殊问题的根源在于使用了错误的PromiseKit版本。我在运行pod install时没有定义PromiseKit应该是什么版本,希望这种模糊性将使安装能够选择最新版本。(另外,按照网站上的建议,最初具体说明版本:
swift_version = "3.0"
pod "PromiseKit", "~> 4.0"将返回一个无法访问4.0的错误)。这一错误是:
` 'PromiseKit (~>4.0)' required by 'Podfile'
None of your spec sources contain a spec satisfying the dependency:...这是总体问题(我需要使用4.0规范)。为了消除这个错误,我运行了以下命令:
pod repo remove master
pod setup
pod install #in the project directory... after modifying the podfile to the code
#written above... ie. including the '"~> 4.0"'不过,回购和安装需要一些时间。
发布于 2017-03-05 03:48:17
安装好后,需要打开.xcworkspace文件而不是.xcodeproject文件。此外,由于您已经为PromiseKit安装了pod,因此不需要再次链接框架。只需在xcode中打开.xcworkspace,就可以导入PromiseKit。
发布于 2020-10-23 04:08:51
在我的例子中,iOS部署目标对于Pod目标来说已经过时了。
若要解决问题,请在“项目”导航中选择“iOS”,选择“项目目标”,并在“生成设置”中更新“部署目标”。

https://stackoverflow.com/questions/42604010
复制相似问题