架构x86_64的未定义符号,用于带有Alamofire.Request的扩展

时间:2016-02-16 20:53:52

标签: swift2 linker-errors alamofire

我为Alamofire.Response创建了一个协议,然后像这样扩展它

import Alamofire
public protocol MyResponseType {
    typealias Value
    typealias Error: ErrorType
    var request: NSURLRequest? { get }
    var response: NSHTTPURLResponse? { get }
    var data: NSData? { get }
    var result: Alamofire.Result<Value, Error> { get }
    init(request: NSURLRequest?, response: NSHTTPURLResponse?, data: NSData?, result: Alamofire.Result<Value, Error>, timeline: Alamofire.Timeline)
}

extension Alamofire.Response: MyResponseType {}

构建过程已经过去,但是当涉及链接时,它会失败。这是错误

Undefined symbols for architecture x86_64:
  "Alamofire.Response.data.getter : __ObjC.NSData?", referenced from:
      protocol witness for wtftest. MyResponseType.data.getter : __ObjC.NSData? in conformance <A, B where B: Swift.ErrorType> Alamofire.Response<A, B> : wtftest. MyResponseType in wtftest in ViewController.o
  "Alamofire.Response.result.getter : Alamofire.Result<A, B>", referenced from:
      protocol witness for wtftest. MyResponseType.result.getter : Alamofire.Result<A.Value, A.Error> in conformance <A, B where B: Swift.ErrorType> Alamofire.Response<A, B> : wtftest.ProducerResponseType in wtftest in ViewController.o
  "Alamofire.Response.request.getter : __ObjC.NSURLRequest?", referenced from:
      protocol witness for wtftest. MyResponseType.request.getter : __ObjC.NSURLRequest? in conformance <A, B where B: Swift.ErrorType> Alamofire.Response<A, B> : wtftest. MyResponseType in wtftest in ViewController.o
  "Alamofire.Response.response.getter : __ObjC.NSHTTPURLResponse?", referenced from:
      protocol witness for wtftest. MyResponseType.response.getter : __ObjC.NSHTTPURLResponse? in conformance <A, B where B: Swift.ErrorType> Alamofire.Response<A, B> : wtftest.ProducerResponseType in wtftest in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这是一个快速的错误吗?或者我做错了什么?

0 个答案:

没有答案