'SCDynamicStoreCreate' is unavailable: not available on iOS

纵饮孤独 提交于 2019-12-11 07:18:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!