在試圖創建一個啓動輔助按照蘋果文檔(和tutorial-ized),I似乎擊打引起的移植Objective-C代碼到夫特打嗝。在這種情況下,誰的編譯器不能再多餘。類型「布爾」不符合協議「BooleanType」
import ServiceManagement
let launchDaemon: CFStringRef = "com.example.ApplicationLauncher"
if SMLoginItemSetEnabled(launchDaemon, true) // Error appears here
{
// ...
}
的錯誤似乎始終是:
Type 'Boolean' does not conform to protocol 'BooleanType'
我曾嘗試在多個位置鑄造Bool
,如果我只是一個redundant, archaic primitive處理(通過引進Obj-C或Core Foundation),無濟於事。
以防萬一,我已經試過鑄造響應:
SMLoginItemSetEnabled(launchDaemon, true) as Bool
其產生錯誤:
'Boolean' is not convertible to 'Bool'
...重視呢?
親愛的克里斯,你可以添加我的Skype:[email protected]&幫我實施SMLoginItemSetEnabled。我現在在線。非常感謝。 – 2015-06-01 07:48:24