找不到 Alamofire 框架(Xcode-8.2.1 和 iOS 10.2)
Alamofire framework not found(Xcode-8.2.1 and iOS 10.2)
我已经尝试了很多解决方案,但最终还是不知道该怎么办。我刚刚为 Alamofire 安装了 cocoa pods 和 swiftyJson 。现在,当我 清理并构建 我的项目时,出现错误
NO SUCH FRAMEWORK ALAMOFIRE
当我尝试在任何 swift 文件中导入 Alamofire 时,它说:
NO SUCH MODULE ALAMOFIRE
我更新的 Podfile 是这样的(No such framework Alamofire 错误被这个 pod 文件解决了)。但是仍然没有这样的 Module alamofire-:
# Uncomment the next line to define a global platform for your project
platform :ios, ’10.2’
source 'https://github.com/CocoaPods/Specs.git'
target 'ModesTests' do
use_frameworks!
pod 'Alamofire', '~> 4.4'
target 'ModesUITests' do
inherit! :search_paths
# Pods for testing
end
end
这就是我创建 Modes.xcworkspace 并安装 pods 并创建 pod 文件的方式 -:
1) 打开终端
2) 使用 cd 命令导航到包含您的 ModesSample 项目的目录:
3) 给出初始化命令
pod init
4) 使用命令打开 Podfile-:
open -a Xcode Podfile
创建的 pod 文件如上所示最后一步是-:
5) pod install
我都验证了什么-:
1) 我在路径下添加了 Alamofire.framework -: Modes->General->Linked Frameworks and Libraries
2) 尝试在以下位置添加 Alamofire 目录路径:Build settings->Framework search paths
3) 仅验证构建活动架构的值是-:
DEBUG:YES
RELEASE:NO
谁能帮我解决这个问题,我已经试了3次了。谢谢
从 pod 获取时,您不需要 link 框架(Alamofire 或 SwiftyJSON)。所有 linking 都是从 pod 自动完成的。你只需要导入它们。
我为你试过了,效果很好。
enter image description here
将以下文本粘贴到您的播客文件中。
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'ModesTests' do
pod 'Alamofire', '~> 4.4'
target 'ModesUITests' do
inherit! :search_paths
# Pods for testing
end
end
保存。
然后 运行 在终端中输入命令“$ pod install”。(如果您之前没有安装过)。
如果你想更新 Alamofire 然后 运行 命令“$ pod update”
谢谢..!!!
使用以下内容更改您的 Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
def shared_pods
pod 'Alamofire'
pod 'SwiftyJSON'
end
target 'Modes' do
# Pods for Modes
shared_pods
end
target 'ModesTests' do
inherit! :search_paths
# Pods for testing
shared_pods
end
target 'ModesUITests' do
inherit! :search_paths
# Pods for testing
shared_pods
end
重新分解 pod 并重新安装 pod。
这就是我为 ios-10.2 和 Xcode -:8.2.1 所做的(效果很好)
1) 创建项目。
2) 转到终端
3) 给出命令 cd desktop
(如果项目在桌面上)
4) cd project name
5) pod init
(这在目录中创建了 pod 文件)
6) 使用这个 pod fie-:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
def shared_pods
use_frameworks!
pod 'Alamofire', '~> 4.4'
pod 'SwiftyJSON'
end
target 'Modes' do
# Pods for Modes
shared_pods
end
target 'ModesTests' do
inherit! :search_paths
# Pods for testing
shared_pods
end
target 'ModesUITests' do
inherit! :search_paths
# Pods for testing
shared_pods
end
MARK-: I added use_frameworks under function shared_pods ( That allowed me to use frameworks) don't put it outside it.
7) 保存 pod 文件
8) pod install
9) 关闭终端和所有打开的项目。
10) 进入项目目录并打开Projectname.xcworkspace.
11) 首先 清理并构建。
12) 导入 Alamofire
13) Bravo 使用你的框架。
NO SUCH FRAMEWORK ALAMOFIRE
当我尝试在任何 swift 文件中导入 Alamofire 时,它说:
NO SUCH MODULE ALAMOFIRE
我更新的 Podfile 是这样的(No such framework Alamofire 错误被这个 pod 文件解决了)。但是仍然没有这样的 Module alamofire-:
# Uncomment the next line to define a global platform for your project
platform :ios, ’10.2’
source 'https://github.com/CocoaPods/Specs.git'
target 'ModesTests' do
use_frameworks!
pod 'Alamofire', '~> 4.4'
target 'ModesUITests' do
inherit! :search_paths
# Pods for testing
end
end
这就是我创建 Modes.xcworkspace 并安装 pods 并创建 pod 文件的方式 -:
1) 打开终端
2) 使用 cd 命令导航到包含您的 ModesSample 项目的目录:
3) 给出初始化命令
pod init
4) 使用命令打开 Podfile-:
open -a Xcode Podfile
创建的 pod 文件如上所示最后一步是-:
5) pod install
我都验证了什么-:
1) 我在路径下添加了 Alamofire.framework -: Modes->General->Linked Frameworks and Libraries
2) 尝试在以下位置添加 Alamofire 目录路径:Build settings->Framework search paths
3) 仅验证构建活动架构的值是-:
DEBUG:YES
RELEASE:NO
谁能帮我解决这个问题,我已经试了3次了。谢谢
从 pod 获取时,您不需要 link 框架(Alamofire 或 SwiftyJSON)。所有 linking 都是从 pod 自动完成的。你只需要导入它们。
我为你试过了,效果很好。 enter image description here
将以下文本粘贴到您的播客文件中。
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'ModesTests' do
pod 'Alamofire', '~> 4.4'
target 'ModesUITests' do
inherit! :search_paths
# Pods for testing
end
end
保存。 然后 运行 在终端中输入命令“$ pod install”。(如果您之前没有安装过)。 如果你想更新 Alamofire 然后 运行 命令“$ pod update”
谢谢..!!!
使用以下内容更改您的 Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
def shared_pods
pod 'Alamofire'
pod 'SwiftyJSON'
end
target 'Modes' do
# Pods for Modes
shared_pods
end
target 'ModesTests' do
inherit! :search_paths
# Pods for testing
shared_pods
end
target 'ModesUITests' do
inherit! :search_paths
# Pods for testing
shared_pods
end
重新分解 pod 并重新安装 pod。
这就是我为 ios-10.2 和 Xcode -:8.2.1 所做的(效果很好)
1) 创建项目。
2) 转到终端
3) 给出命令 cd desktop
(如果项目在桌面上)
4) cd project name
5) pod init
(这在目录中创建了 pod 文件)
6) 使用这个 pod fie-:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
def shared_pods
use_frameworks!
pod 'Alamofire', '~> 4.4'
pod 'SwiftyJSON'
end
target 'Modes' do
# Pods for Modes
shared_pods
end
target 'ModesTests' do
inherit! :search_paths
# Pods for testing
shared_pods
end
target 'ModesUITests' do
inherit! :search_paths
# Pods for testing
shared_pods
end
MARK-: I added use_frameworks under function shared_pods ( That allowed me to use frameworks) don't put it outside it.
7) 保存 pod 文件
8) pod install
9) 关闭终端和所有打开的项目。
10) 进入项目目录并打开Projectname.xcworkspace.
11) 首先 清理并构建。
12) 导入 Alamofire
13) Bravo 使用你的框架。