【发布时间】:2018-05-03 08:45:16
【问题描述】:
通过使用这个Answer,我在 swift 4.1 中遇到了这个错误,即Cannot convert value of type 'Int' to expected argument type 'UnsafeMutablePointer<Int32>!'
var notify_token: Int
notify_register_dispatch("com.apple.springboard.lockstate", notify_token, DispatchQueue.main, { (_ token: Int) -> Void in
var state: UInt64 = UINT64_MAX
notify_get_state(token, state)
if state == 0 {
print("unlock device")
}
else {
print("lock device")
}
如何解决?
【问题讨论】:
-
var notify_token: Int32 ??检查这是否适合你 1
-
是的,它的工作,但现在这个comming:
Cannot convert value of type 'UInt64' to expected argument type 'UnsafeMutablePointer<UInt64>!'@Roshan