gpt4 book ai didi

ios - CanOpenUrl 方法不适用于 ios 9

转载 作者:搜寻专家 更新时间:2023-11-01 05:47:37 24 4
gpt4 key购买 nike

我在我的应用程序中使用了 CanOpenUrl 方法,它在 iOS 8.4 上运行,但是当我将模拟器更改为 9.2 时,它无法运行。我找不到原因。这些是我的代码;

if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"deeplinking://"]]){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"deeplinking://"]];
}
else{
NSLog(@"not working!");
}

有人能帮帮我吗?谢谢你,哈利尔。

最佳答案

出于安全目的,Apple 在 iOS 9 及以上版本 中引入了 NSAppTransportSecurity 的新概念,这是必需的

您必须在 info.plist 文件的 NSAppTransportSecurity 字典中将 NSAllowsArbitraryLoads 键添加到 YES .

例如,

 <key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

enter image description here

你可以在apple中看到这个文档.例如

enter image description here

关于ios - CanOpenUrl 方法不适用于 ios 9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35746179/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com