Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 为什么NehostThelper注册表的选项返回FALSE?_Ios_Objective C_Networkextension - Fatal编程技术网

Ios 为什么NehostThelper注册表的选项返回FALSE?

Ios 为什么NehostThelper注册表的选项返回FALSE?,ios,objective-c,networkextension,Ios,Objective C,Networkextension,当我尝试调用registerWithOptions时,您知道我的代码和设置中缺少了什么吗?它总是返回false 我已经拥有NetworkExtension权限 我已经创建了一个权限 并且已经在.plist中创建了一个数组 这是我的密码: NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:@"Try here", kNEHotspotHelperOptionDisplayName, nil]; dispatc

当我尝试调用registerWithOptions时,您知道我的代码和设置中缺少了什么吗?它总是返回false

我已经拥有NetworkExtension权限

我已经创建了一个权限

并且已经在.plist中创建了一个数组

这是我的密码:

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:@"Try here", kNEHotspotHelperOptionDisplayName, nil];

dispatch_queue_t queue = dispatch_queue_create("com.myapp.ex", 0);

BOOL isAvailable = [NEHotspotHelper registerWithOptions:options queue:queue handler: ^(NEHotspotHelperCommand * cmd) {

    NSLog(@"Sucessfully Registered");
}];

检查您的应用程序是否使用正确的授权文件签名。可以使用以下命令执行此操作:

codesign -d --entitlements :- /Users/User/Library/Developer/Xcode/DerivedData/appname-atpabrbgvqunorhiggpf/Build/Products/Debug-iphoneos/AppName.app
在输出中,您应该看到以下两项权利:

<key>com.apple.developer.networking.HotspotHelper</key>
<true/>
<key>com.apple.developer.networking.networkextension</key>
<array>

除了上面的答案,你还必须把这个信息放在你的Info.plist上

<key>UIBackgroundModes</key>
<array>
   <string>network-authentication</string>
</array>
ui背景模式
网络认证
<key>UIBackgroundModes</key>
<array>
   <string>network-authentication</string>
</array>