The command could not be completed due to a signal: Segmentation Error: 11 | Xcode 7.2

I was asked to port a rather large application to Swift 2. The compiler continues to throw a segmentation error: 11 errors for one function present in different modules of the application logic (only the difference is used in the variables):

func loadMoreContent() {

if let collection = self.ratingsCollection where collection.identifier != 0,
  let totalEntries = collection.totalEntries,
  let objects = self.ratings?.count where objects < totalEntries {

    self.ratingsCollection = nil

    collection.nextPage().onSuccess { (value) in

      if let collection = value as? Collection<Rating> {
        self.ratingsCollection = collection
      } else {
        self.ratingsCollection = Collection<Rating>(identifier: 0)
      }

      }.onFailure { error in
        self.ratingsCollection = Collection<Rating>(identifier: 0)
    }
  }
}

Here are the errors themselves:

1.  While type-checking 'loadMoreContent' at (path redacted).swift:46:3
2.  While type-checking expression at [(path redacted).swift:54:9 - line:64:9] 
    RangeText="collection.nextPage().onSuccess { (value) in

              if let collection = value as? Collection<Rating> {
                self.ratingsCollection = collection
              } else {
                self.ratingsCollection = Collection<Rating>(identifier: 0)
              }

              }.onFailure { error in
                self.ratingsCollection = Collection<Rating>(identifier: 0)
            }"

3.  While loading members for declaration 0x7fdda42ea2b0 at <invalid loc>
4.  While deserializing 'producer' (FuncDecl #340) 

Does anyone know what might be wrong with this feature at first glance? I have to add its compilation without changes in Xcode 6 / Swift 1.2.

+4
source share
1 answer

This is a hair pulling bug, especially common in Xcode7.

XCode (, XCode, , ) . . , !

, . - ​​ , .

, , , . , , , , :

1) "" , ( XCGLogger):

 public func myFunc(@autoclosure closure: () -> String?){
      // do something
 }

 someInstance.myFunc("Hi " + nameStr + "!")

2) super.init() , ( init)

3) ( = ==), , .

+3

Source: https://habr.com/ru/post/1620286/


All Articles