一个月前,我开始在Swift中开展一个项目。我在XCode 6.0中启动了这个项目,昨天我将XCode更新到了6.1版本。在此更新之后,我无法编译项目,并且我得到了奇怪的编译错误(编译大约需要10分钟)。我没有改变项目内部的任何内容,我测试过,当我创建新的Swift项目时,我能够编译它,我已经尝试清理项目,重新启动OS X并且基本上我已经没有选择......
以下是我收到的日志(标题为命令因信号失败:已被杀: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
答案 0 :(得分:1)
你主要有3个问题,
可用的初始化程序。
如this article中所述。 Swift 1.1引入了Failable Initializers。这意味着,初始化程序可能会失败并返回nil
。你必须检查它不是nil
并打开它。这适用于:
error: value of optional type 'UIImage?' not unwrapped; did you mean to use '!' or '?'?
error: 'NSURL?' does not have a member named 'lastPathComponent'
CFString
处理错误
请参阅此问题:Type 'CFStringRef' does not conform to protocol 'Hashable' in Xcode 6.1。这适用于:
error: type 'CFString!' does not conform to protocol 'NSCopying'
error: type 'CFString!' does not conform to protocol 'Hashable'
解决方法如下:
curFrameGIFProperties[kCGImagePropertyGIFUnclampedDelayTime as NSString]
^^^^^^^^^^^
enum
原始值界面更改
这适用于:
error: method 'fromRaw' has been replaced with a property 'rawValue'
使用toRaw()
属性:
rawValue
方法
dictParams += ["category":self.category.rawValue]