The System Configuration framework is a C api, so it's a little bit messy, but this should work ok without leaking:#import <SystemConfiguration/SCNetworkConfiguration.h>SCDynamicStoreRef storeRef = SCDynamicStoreCreate(NULL, (CFStringRef)@"GetWorkgroup", NULL, NULL);CFPropertyListRef global = SCDynamicStoreCopyValue (storeRef,CFSTR("State:/Network/Global/SMB"));id workgroup = [(__bridge NSDictionary *)global valueForKey:@"Workgroup"];NSLog(@"Workgroup: %@", workgroup);CFRelease(global);CFRelease(storeRef); 这篇关于Mac OS X以编程方式获取域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-26 12:55