0
我試圖獲得打開的窗口及其PID的列表。獲取打開的Windows錯誤列表
這是我想出的代碼:
CFArrayRef WindowList中= CGWindowListCreate(kCGWindowListOptionOnScreenOnly,kCGNullWindowID);
if (windowList == nil || NULL)
NSLog(@"The List is null");
for(NSMutableDictionary *entry in (__bridge NSArray *)windowList){
NSString *ownerName = [entry objectForKey:(__bridge id)kCGWindowOwnerName];
NSInteger ownerPID = [[entry objectForKey:(__bridge id)kCGWindowOwnerPID]integerValue];
NSLog(@"%@:%ld",ownerName, ownerPID);
}
在生產線在這裏我聲明OWNERNAME我得到一個異常(線程1:SIGBART)
我無法弄清楚什麼是錯....的CFArrayRef不爲NULL /零