2014-09-02 50 views
5

我已成功将'RestKit'窗格添加到我的项目中,并且还遵循本文中描述的步骤:Cocoapods in swift。我进口RestKit到我ViewController类的源文件:在Swift中使用RestKit

import RestKit 

但我不知道为什么我不能访问它。它不会显示RestKit中的任何类。它显示:

'RestKit'不存在这样的模块。


我试图重新创建一个新的项目,并增加了 'RestKit'。并创建了一个桥接头并将'RestKit'导入到ViewController claas的源文件中。现在我运行该项目 它显示像

// in this file Pods-SOCKit-prefix.pch 

    #ifdef __OBJC__ 
    #import <UIKit/UIKit.h> 
    #endif 

    #import "Pods-environment.h" // Pods-environment.h file not found 

// and also in this file Pods-TransitionKit-prefix.pch 


    #ifdef __OBJC__ 
    #import <UIKit/UIKit.h> 
    #endif 

    #import "Pods-environment.h" // Pods-environment.h file not found 

错误如果有人知道什么是这背后的问题,请向我解释,并提出一个方法,在斯威夫特RestKit工作。

+0

尝试看看http://stackoverflow.com/questions/24736739/restkit-coredata-and-swift-i-cant-seem-to-fetch -results-back-out – 2014-09-22 07:54:52

回答

9

我不知道你有什么Cocoapods问题。我添加了RestKit到我的桥接头,并且不需要将import RestKit添加到我的Swift文件中。

我的桥接报如下所示:

# if you are using Core Data: 
#import <CoreData/CoreData.h> 

#import <RestKit/RestKit.h> 

# if you are using Core Data: 
#import <RestKit/CoreData.h> 
+0

#import 首先,如果您不是在桥接头中导入核心数据,请使用#import Renatus 2014-11-28 16:16:29