在试图创建一个启动辅助按照苹果文档(和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