'SCDynamicStoreCreate'不可用:在iOS上不可用 [英] 'SCDynamicStoreCreate' is unavailable: not available on iOS

查看:327
本文介绍了'SCDynamicStoreCreate'不可用:在iOS上不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个试图检测移动热点的应用程序.我用谷歌搜索并尝试实现它.我导入了

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>

并尝试了此代码,

SCDynamicStoreRef sc = SCDynamicStoreCreate(NULL, CFSTR("com.apple.wirelessmodemsettings.MISManager"), NULL, NULL);
NSDictionary* info = (__bridge_transfer NSDictionary*)SCDynamicStoreCopyValue(sc, CFSTR("com.apple.MobileInternetSharing"));

我两行都出现错误,

'SCDynamicStoreCreate' is unavailable: not available on iOS
'SCDynamicStoreCopyValue' is unavailable: not available on iOS

我该如何解决?(XCode版本8.2.1)

How can I solve this?(XCode version 8.2.1)

推荐答案

创建具有与SCDynamicStore.h完全相同的内容的头文件.删除__OSX_AVAILABLE_STARTING的所有条目.导入此新标头而不是<SystemConfiguration/SCDynamicStore.h>.

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>.

那应该做.

我从@crecker的答案此处中学到了这一点.

I learned this from @crecker's answer here.

这篇关于'SCDynamicStoreCreate'不可用:在iOS上不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆