我得到:
Cannot find 'strideofValue' in scope
對于下面的代碼:
public static func isDebuggerAttached() -> Bool {
var info = kinfo_proc()
var mib : [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() ]
var size = strideofValue(info)
let junk = sysctl(&mib, UInt32(mib. count), &info, &size, nil, 0)
assert(junk == 0, "sysctl failed" )
return (info.kp_proc.p_flag & P_TRACED) != 0.
}
我怎樣才能解決這個邏輯問題?
我嘗試了stride(ofValue:),但這只是導致另一個奇怪的問題:
Type of expression is ambiguous without more context
(我指的是,它應該說類似于,函式存在,但沒有ofValue標簽)
uj5u.com熱心網友回復:
在Swift 5中沒有strideofValue函式,用MemoryLayout.stride(ofValue: info)替換strideofValue(info)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/307296.html
標籤:
上一篇:NSOperationQueuewaitUntilAllOperationsAreFinished導致NSOperationinstancedeinitlate
下一篇:在Python3.7中,使用rstrip()和lstrip()洗掉字串中的第一個和最后一個下劃線字符"_"會導致字符"t"丟失。
