通过REAN文在此提供的答案后的雨燕2.2伟大的工作,但现在我已经升级到了XCode 8.0斯威夫特3,它不工作了。
我收到以下错误消息:
.../project/AppDelegate.swift:41:108: Cannot convert value of type '(@convention(c) (CFNotificationCenter?, UnsafeMutableRawPointer?, CFString?, UnsafeRawPointer?, CFDictionary?) -> Void)!' to expected argument type 'CFNotificationCallback!'
从这一行:
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), nil, LockNotifierCallback.notifierProc(), "com.apple.springboard.lockcomplete", nil, CFNotificationSuspensionBehavior.DeliverImmediately)
在AppDelegate.swift文件中。
有谁知道如何解决这个问题?自从我刚开始学习Swift以来,我们将不胜感激。
这可能对您有用。
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
nil,
{ (_, observer, name, _, _) in
print("received notification: \(name)")
},
"com.apple.springboard.lockcomplete" as CFString!,
nil,
.deliverImmediately)
您可以检查此答案以获取更多详细信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句