CanOpenUrl方法无法在iOS 9中使用 [英] CanOpenUrl method not working ios 9
问题描述
我在我的应用程序中使用了CanOpenUrl方法,该方法在iOS 8.4上可以正常使用,但是当我将模拟器更改为9.2时,它无法正常使用.我找不到原因.这些是我的密码;
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"deeplinking://"]]){[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"deeplinking://"]];}别的{NSLog(@不工作!");}
有人可以帮助我吗?谢谢哈利尔.
出于安全目的,Apple在 iOS 9及更高版本
中引入了 NSAppTransportSecurity
的新概念,它是需要
您只需将 NSAllowsArbitraryLoads
键添加到 info.plist
文件中的 NSAppTransportSecurity
词典中的 YES
中,
例如,
< key> NSAppTransportSecurity</key>< dict>< key> NSAllowsArbitraryLoads</key>< true/></dict>
您可以在
I have used CanOpenUrl method in my app, and it was working on iOS 8.4 but when I changed to simulator to 9.2, it's not working. I couldn't find the reason. These are my codes;
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"deeplinking://"]]){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"deeplinking://"]];
}
else{
NSLog(@"not working!");
}
Can anybody help me? Thank you, Halil.
for security purpose Apple has introduced the new concept of NSAppTransportSecurity
in iOS 9 and above
,it is needed
You have to add just the NSAllowsArbitraryLoads
key to YES
in NSAppTransportSecurity
dictionary in your info.plist
file.
For example,
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
you can see this document in apple. for example
这篇关于CanOpenUrl方法无法在iOS 9中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!