问题
I am working on an app, where I am trying to detect mobile Hotspot. I googled about this and trying to implement that. I imported
#include <SystemConfiguration/SCDynamicStore.h>
and tried this code,
SCDynamicStoreRef sc = SCDynamicStoreCreate(NULL, CFSTR("com.apple.wirelessmodemsettings.MISManager"), NULL, NULL);
NSDictionary* info = (__bridge_transfer NSDictionary*)SCDynamicStoreCopyValue(sc, CFSTR("com.apple.MobileInternetSharing"));
I am getting error in both lines,
'SCDynamicStoreCreate' is unavailable: not available on iOS
'SCDynamicStoreCopyValue' is unavailable: not available on iOS
How can I solve this?(XCode version 8.2.1)
回答1:
Create a header file with exact content as that of SCDynamicStore.h
. Remove all entries of __OSX_AVAILABLE_STARTING
. Import this new header instead of <SystemConfiguration/SCDynamicStore.h>
.
That should do.
I learned this from @crecker's answer here.
来源:https://stackoverflow.com/questions/42998035/scdynamicstorecreate-is-unavailable-not-available-on-ios