2017-04-06 46 views
1

enter image description here我已经尝试了那么多的解决方案,但最终没有得到该做什么。我刚刚为Alamofire和swiftyJson安装了可可豆荚。而现在,当我清理并生成项目中,我得到一个错误未找到Alamofire框架(Xcode-8.2.1和iOS 10.2)

没有这样的框架ALAMOFIRE

当我尝试进口Alamofire任何快捷文件,它说:

NO这种模块ALAMOFIRE

我更新的Podfile是这样的(没有这样的框架Alamofire错误是由这个pod文件解决的)。但仍然没有得到这样的模块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和安装荚荚创建文件 - :

1)打开终端

2)使用cd命令导航到包含ModesSample项目的目录:

3)给init命令

pod init 

4)使用命令 - 打开Podfile:

open -a Xcode Podfile 

创建荚文件上面的最后一个步骤是 - 显示:

5) pod install 

我什么都已验证 - :

1)我在路径下添加了Alamofire.framework - :Modes->常规 - >

2)尝试添加Alamofire目录路径欠关联的框架和库:构建设置 - >框架搜索路径

3)验证构建有源体系值只能是─:

DEBUG:YES 
RELEASE:NO 

任何人都可以请帮我解决这个问题,我已经尝试过3次了。谢谢

+0

@Sneak okk明白了你的观点你对这个问题有什么想法吗? –

+0

我不知道,这可能帮助你:http://stackoverflow.com/questions/25817479/cannot-install-alamofire-in-new-xcode-project-no-such-module-alamofire,也请避免删除你的问题,并重新发布他们碰到他们。祝你好运。 – 2017-04-06 03:42:39

+1

@Sneaks谢谢,我会再试一次。 –

回答

1

这是我完全为IOS-10.2和Xcode的一样 - 8.2.1(这个伟大的工程)

1)创建一个项目。

2)转到终端

3)给命令cd desktop(如果在桌面上的项目)

4)cd project name

5)pod init(这造成在目录荚文件)

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-:我加use_frameworks下功能shared_pods(这允许我使用的框架),不要把它外面。

7)保存文件荚

8)pod install

9)关闭终端及所有打开的项目。

10)转到项目目录并打开Projectname.xcworkspace。

11)First Clean and Build

12)进口Alamofire

13)布拉沃用你的框架。

0

从pod提取时,不需要链接框架(Alamofire或SwiftyJSON)。所有链接都是从pod自动完成的。你只需要导入它们。

我试过这个给你,它工作。 enter image description here

+0

所以我应该链接?像 - :Pods_Modes.framework的东西? –

+0

nope。我想你是通过从项目中整合你的豆荚来解决它的。但是你仍然不需要手动链接豆荚。您也可以执行“$ pod clean”以移除现有的工作区并创建新的工作区。 – littleom

+0

nopes pod deintegrate没有解决它。实际上解决的是在目标'Modes'下编写use_framworks –

1

将以下文本粘贴到您的podfile中。

# 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”

谢谢.. !!!

+0

嗨你的命令很有用,但还有一个步骤要做 - :转到Build settings-> framework搜索路径 - >添加这个 - :'$(继承)'。然后清理并构建。 –

+0

我现在得到这个警告 - :找不到选项'-F'''的目录。 –

+0

解决它只增加$(继承)到豆荚 - >生成设置 - >框架搜索路径 –

1

更改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 

执行荚deintegrate荚再次安装。

+0

谢谢你会试试这个 –

+0

感谢你的代码a我的一点想法a nd我们解决了它:) –