1

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)

Forte Zhu
  • 742
  • 3
  • 12
  • 33

1 Answers1

0

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.

Community
  • 1
  • 1
Yogi
  • 3,578
  • 3
  • 35
  • 56