使用Cocopoads时Xcode 7.3中的奇怪错误

时间:2016-04-13 10:41:14

标签: xcode swift cocoapods

我收到了警告,但这些错误是主要问题:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FDataSnapshot", referenced from:
      type metadata accessor for __ObjC.FDataSnapshot in MapVC.o
  "_OBJC_CLASS_$_Firebase", referenced from:
      type metadata accessor for __ObjC.Firebase in DataService.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

发生了什么?

更新:

因此当我在我的Mac上使用模拟器时会弹出错误,但是当我使用我的iPhone作为模拟器时,一切都很好。谁知道为什么?

2 个答案:

答案 0 :(得分:1)

好的,这可能对某人有所帮助,所以我发布了答案。

我注意到了我的终端 Re-creating CocoaPods due to major version update. 所以这显然搞砸了我的代码。只需删除Pods文件夹,工作区并运行pod install

即可

现在一切正常。

答案 1 :(得分:1)

你能不能跑

let mapDict = [ "a":"First", "b":"Second"]

let json = [ "title":"kk" , "dict": mapDict ]
let jsonData = NSJSONSerialization.dataWithJSONObject(json, options: .PrettyPrinted, error: nil)

// create post request
let url = NSURL(string: "http://example.com/post")!
let request = NSMutableURLRequest(URL: url)
request.HTTPMethod = "POST"

// insert json data to the request
 request.HTTPBody = jsonData


 let task =  NSURLSession.sharedSession().dataTaskWithRequest(request){  data,response,error in
 if error != nil{
    println(error.localizedDescription)
    return
}
if let responseJSON = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) as? [String:AnyObject]{
    println(responseJSON)
}
}

task.resume()

然后你不必删除pod文件夹和工作区..