3
創建PDF我下面Apple's Docs斯威夫特創建使用Xcode6-Beta6 PDF文件在斯威夫特
var currentText:CFAttributedStringRef = CFAttributedStringCreate(nil, textView.text as NSString, nil)
if (currentText) { // <-- This is the line XCode is not happy
// More code here
}
編譯器會引發Type 'CFAttributedStringRef' does not conform to protocol 'BooleanType'
錯誤
如果我使用if(currentText != nil)
我得到'CFAttributedStringRef' is not convertible to 'UInt8'
從蘋果公司的Docs for CFAttributedStringCreate
Return Value
An attributed string that contains the characters from str and the attributes specified by attributes. The result is NULL if there was a problem in creating the attributed string. Ownership follows the Create Rule.
任何想法如何解決這個問題?謝謝!