SequenceType生成器通用Swift [英] SequenceType Generator Generic Swift

查看:61
本文介绍了SequenceType生成器通用Swift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试运行此代码时遇到一些问题,我发现使用相同代码的几个示例,但出现编译器错误

I'm having some issues trying to run this code, I found couple examples using the same code but I get compiler error

未定义架构arm64的符号:
ExpSwift.SearchResults.generate()-> Swift.IndexingGenerator< [A]>,引用自:
ExpSwift_Example.ViewController。(viewDidLoad()->())。 (关闭#1)。(关闭#3)在ViewController.o
ld:体系结构arm64
lang找不到符号:错误:链接器命令失败,退出代码为1(使用-v见调用)

Undefined symbols for architecture arm64: "ExpSwift.SearchResults.generate () -> Swift.IndexingGenerator<[A]>", referenced from: ExpSwift_Example.ViewController.(viewDidLoad () -> ()).(closure #1).(closure #3) in ViewController.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

这是我的代码类

public final class SearchResults<T> {

var results = [T]();
let total: Int64

required public init?(results: [T], total: Int64) {
    self.results = results
    self.total = total
}

public func getResults() -> [T] {
    return self.results
}

public func getTotal() -> Int64 {
    return self.total
}

}


extension SearchResults : SequenceType {
   public func generate() -> IndexingGenerator<Array<T>> {
    return results.generate()
   }
}

然后用Alamofire调用它

and then calling this with Alamofire

ExpSwift.findLocations(["limit":10, "skip":0, "sort":"name"]).then { (locations: SearchResults<Location>) -> Void in
            for location:Location in locations{
                debugPrint(location.get("name"))
            }

            }.error { error in
                debugPrint(error)
        }


推荐答案

外观就像只用cocoapods或Xcdoe一样,对我来说,解决方案是更新Xcode 8并下载Xcode 7.3。如果我使用Xcode 7.3,请解决编译器的问题。我尝试过几次构建,​​但几次后仍能正常工作。

Looks like is just something with cocoapods or Xcdoe, the solution for me was just update Xcode 8 and download Xcode 7.3 . If I work with Xcode 7.3 fix the issue with the compiler. I try several times to build and after couple times it works.

这篇关于SequenceType生成器通用Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆