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