0

A month ago i started woking on one project in Swift. I started this project in XCode 6.0 and yesterday i updated the XCode to version 6.1. After this update I'm unable to compile the project and I'm getting weird compile error (also the compilation takes about 10 minutes). I've not changed anything inside the project, I've tested that when I create new Swift project I'm able to compile it, I've tried to clean project, restart OS X and basically i've run out of options...

Here is the log I'm getting (It has a title Command failed due to signal: Killed: 9)

CompileSwift normal arm64 /Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift
    cd /Users/premyslsemerad/Code iOS/BriLife/BriLife GIT
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THRegisterVC.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THLoginVC.swift" "/Users/premyslsemerad/Code iOS/THKit/THVault.swift" -primary-file "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Libraries/Snappy/View.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THSplashVC.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/AppDelegate.swift" "/Users/premyslsemerad/Code iOS/THKit/UITableView+Pagination.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THModelAPI.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THCellMyGIFs.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Libraries/Snappy/ConstraintMaker.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THTextField.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THRefreshControl.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THCellComment.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THBriLifeMenu.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THViewFinishOverlay.swift" "/Users/premyslsemerad/Code iOS/THKit/Async.swift" "/Users/premyslsemerad/Code iOS/THKit/THAPIHelpers.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THViewSelection.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THCellCreateGIF.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THMenuButton.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THCommentsVC.swift" "/Users/premyslsemerad/Code iOS/THKit/THUIHelpers.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THHomeVC.swift" "/Users/premyslsemerad/Code iOS/THKit/THLoader.swift" "/Users/premyslsemerad/Code iOS/THKit/THCustomLog.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THFinishGIFVC.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Libraries/Snappy/Constraint.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THProfileVC.swift" "/Users/premyslsemerad/Code iOS/THKit/THObjectHelpers.swift" "/Users/premyslsemerad/Code iOS/THKit/THActivityIndicator.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THGIFImageView.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Libraries/Snappy/LayoutConstraint.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THSettingsVC.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THMyGIFsVC.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THGeneralVC.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THViewEmpty.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Controllers/THCreateGIFVC.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Views/THCellFeed.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Libraries/Snappy/Insets.swift" "/Users/premyslsemerad/Code iOS/THKit/THLanguage.swift" "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THModel.swift" -target arm64-apple-ios8.0 -Xllvm -aarch64-use-tbi -target-cpu cyclone -target-abi darwinpcs -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -I /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Products/Debug-iphoneos -F /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Products/Debug-iphoneos -g -import-objc-header "/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/briLife-Bridging-Header.h" -module-cache-path /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/ModuleCache -Xcc -I/Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/briLife-generated-files.hmap -Xcc -I/Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/briLife-own-target-headers.hmap -Xcc -I/Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/briLife-all-target-headers.hmap -Xcc -iquote -Xcc /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/briLife-project-headers.hmap -Xcc -I/Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Products/Debug-iphoneos/include -Xcc "-I/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/Pods/Headers" -Xcc "-I/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/Pods/Headers/AFNetworking" -Xcc "-I/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/Pods/Headers/CHTCollectionViewWaterfallLayout" -Xcc -I/Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/DerivedSources/arm64 -Xcc -I/Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -emit-module-doc-path /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/Objects-normal/arm64/THObjects~partial.swiftdoc -Onone -module-name briLife -emit-module-path /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/Objects-normal/arm64/THObjects~partial.swiftmodule -serialize-diagnostics-path /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/Objects-normal/arm64/THObjects.dia -emit-dependencies-path /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/Objects-normal/arm64/THObjects.d -o /Users/premyslsemerad/Library/Developer/Xcode/DerivedData/briLife-fekikiofbzmwsyfqzuakvqqhhapv/Build/Intermediates/briLife.build/Debug-iphoneos/briLife.build/Objects-normal/arm64/THObjects.o

/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift:104:63: error: type 'CFString!' does not conform to protocol 'NSCopying'
        let cfLoopCount: AnyObject? = dictionaryGIFProperties[kCGImagePropertyGIFLoopCount]
                                                              ^
/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift:125:45: error: value of optional type 'UIImage?' not unwrapped; did you mean to use '!' or '?'?
            var newGifItem = GifItem(image: curImage)
                                            ^
                                                    !
/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift:130:66: error: type 'CFString!' does not conform to protocol 'NSCopying'
            let cfFrameDelay: AnyObject? = curFrameGIFProperties[kCGImagePropertyGIFUnclampedDelayTime]
                                                                 ^
/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift:171:63: error: type 'CFString!' does not conform to protocol 'Hashable'
        var fileProperties = [kCGImagePropertyGIFDictionary : [kCGImagePropertyGIFLoopCount : 0]]
                                                              ^
/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift:178:68: error: type 'CFString!' does not conform to protocol 'Hashable'
            var frameProperties = [kCGImagePropertyGIFDictionary : [kCGImagePropertyGIFDelayTime : oneImage.frameDelay]]
                                                                   ^
/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift:195:34: error: 'NSURL?' does not have a member named 'lastPathComponent'
                uwDictMyGifs += [urlFullPath.lastPathComponent : self.metadataForDefaults()]
                                 ^           ~~~~~~~~~~~~~~~~~
/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift:198:32: error: 'NSURL?' does not have a member named 'lastPathComponent'
                var newDict = [urlFullPath.lastPathComponent : self.metadataForDefaults()]
                               ^           ~~~~~~~~~~~~~~~~~
/Users/premyslsemerad/Code iOS/BriLife/BriLife GIT/briLife/Model/THObjects.swift:242:49: error: method 'fromRaw' has been replaced with a property 'rawValue'
        dictParams += ["category":self.category.toRaw()]
                                                ^~~~~~~
                                                rawValue
animal_chin
  • 6,610
  • 9
  • 37
  • 41
  • see this article: [Failable Initializers](https://developer.apple.com/swift/blog/?id=17) – rintaro Nov 12 '14 at 13:33
  • 1
    Besides the syntactical changes in Swift which require you to modify your source, you should always start with a clean build after upgrading Xcode. See [this answer](http://stackoverflow.com/questions/25998429/xcode-version-6-1-6a1030-apple-match-o-linker-error-building/25998724#25998724) how to do that. – zisoft Nov 12 '14 at 13:39

1 Answers1

1

You have mainly 3 problems,

  1. Failable Initializers.
    As mentioned in this article. Swift 1.1 introduces Failable Initializers. It means, initializer can fail and return nil. You have to check it is not nil and unwrap it. This applies to:

    error: value of optional type 'UIImage?' not unwrapped; did you mean to use '!' or '?'?
    error: 'NSURL?' does not have a member named 'lastPathComponent'
    
  2. CFString handling bug
    See this question:Type 'CFStringRef' does not conform to protocol 'Hashable' in Xcode 6.1. This applies to:

    error: type 'CFString!' does not conform to protocol 'NSCopying'
    error: type 'CFString!' does not conform to protocol 'Hashable'
    

    The workaround would be like:

    curFrameGIFProperties[kCGImagePropertyGIFUnclampedDelayTime as NSString]
                                                                ^^^^^^^^^^^
    
  3. enum raw value interface change
    This applies to:

    error: method 'fromRaw' has been replaced with a property 'rawValue'
    

    Instead of toRaw() method, use rawValue property:

    dictParams += ["category":self.category.rawValue]
    
Community
  • 1
  • 1
rintaro
  • 51,423
  • 14
  • 131
  • 139
  • This took me a while. My project is really huge, so there were ~100 things to correct and the xcode didnt give me any errors or warning (only the one i posted) so I had to find them manually (which really sucked). Also I needed to comment the biggest class in this project. In this class i'm using some C code and some Objective-C bridges and apparently this was the main source of the problem. After I commented almost everything and slowly uncommented everything back i was able to found the problematic functions. I had to rewrite those functions in Objective-C. But thanks a lot! – animal_chin Nov 24 '14 at 11:16