在 iOS 应用中,我遇到了应用传输安全性问题:
我在网上阅读了很多帖子,但由于某种原因,我在 Info.plist 中设置的内容似乎被忽略了。我尝试了几种可能性,这是最后一种:
<plist version="1.0">
<dict>
……..
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>mydomain.net</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
……..
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
但是无论我在 Info.plist 中设置什么,我都会收到此消息:
2016-03-25 13:21:17.234 MyApp[3587:1285514] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
Run Code Online (Sandbox Code Playgroud)
我可能会错过什么?
info.plist ios app-transport-security nsapptransportsecurity
我遇到问题,调整文本大小UIWebView
,html
文件位于包中.我已经设法让一个修改过的脚本在其中工作obj-c
,但是使用swift
3时,文本大小没有变化,尽管最佳值在每次单击时都会正确更改button
.这是代码 -
import UIKit
class ViewController: UIViewController {
@IBOutlet var resWebView: UIWebView!
@IBOutlet weak var increaseFont: UIBarButtonItem!
@IBOutlet weak var decreaseFont: UIBarButtonItem!
var defaults = ["textFontSize":40]
@IBAction func fontButtonPressed(sender: UIBarButtonItem) {
var textFontSize = defaults["textFontSize"]
switch sender.tag
{
case 1 : //when decrease
textFontSize = textFontSize! - 10
case 2 ://when increase
textFontSize = textFontSize! + 50
default:
break
}
defaults["textFontSize"] = textFontSize
print(textFontSize)
var jsString = "document.getElementsByTagName('body')[0].style.fontSize='\(defaults["textFontSize"])px'"
resWebView.stringByEvaluatingJavaScript(from: jsString) …
Run Code Online (Sandbox Code Playgroud) 我正在尝试从网页链接打开应用程序,它在 HTTPS 域上的作用就像一个魅力,但是当我在 HTTP(不安全)域上尝试时,通用链接不起作用。
有人知道我是否缺少配置吗?
谢谢!。
我在Xcode 7,IOS 9中测试我的应用程序并得到以下错误:
App Transport Security已阻止明文HTTP(http://)资源加载,因为它不安全.可以通过应用程序的Info.plist文件配置临时例外.
所以我在Info.plist文件中做了一些更改,如下所示,应用程序现在可以在所有IOS版本中正常工作:
<key>NSAppTransportSecurity</key><dict>
<key>NSExceptionDomains</key><dict><key>myserver.com</key><dict>
<key>NSIncludesSubdomains</key><false/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/></dict> </dict></dict>
Run Code Online (Sandbox Code Playgroud)
所以我怀疑这是否仍然是一个永久的修复,或者我是否应该在我的代码中使用NSURLSession.
谢谢,阿宾
http nsurlconnection nsurlsession ios9 app-transport-security
我正在尝试在我的react-native应用程序中获取()一些数据并且它失败了.因此,我发现NetInfo和我在应用程序启动时使用它,并在onRegionChangeComplete
使用iOS模拟器的每个MapView 事件(如果重要的是,iPhone5s和iPhone 6)上使用它,并且unknown
每次都返回NetInfo返回的状态.MapView工作正常,我可以在模拟器上使用Safari浏览网页.我发现与fetch()失败有关的最常见问题是开发人员在其url中使用localhost.我正在使用http://api.openweathermap.org/data/2.5/weather?作为我的网址,所以我相信这是一个模拟器问题.我没有iOS设备可以测试,而MapView还没有用于Android,所以我无法在Android上测试.有人能指出我正确的方向吗?
谢谢.
PS.我正在登录到控制台的获取错误是 - TypeError: Network request failed
这是我的代码:
module.exports = function(latitude, longitude) {
var rootURL = 'http://api.openweathermap.org/data/2.5/weather?APPID=MYAPIKEY&lat=35&lon=139';
console.log(rootURL);
return fetch(rootURL) // fetch is part of react or react-native, no need to import
.then(function(response){ // method chaining used here
// Shorthand to check for an HTTP 2xx response status.
// See https://fetch.spec.whatwg.org/#dom-response-ok
if (response.ok) {
console.log('Response from fetch was ok, returning response to next then');
return response
} else {
// Raise …
Run Code Online (Sandbox Code Playgroud) 我在下面有以下代码,其中Image组件包含两个Image组件.
<View style={styles.container} >
<Image
style={{width: 50, height: 50}}
source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}}
/>
<Image
style={{width: 50, height: 50}}
source={{uri: 'http://lghttp.24811.nexcesscdn.net/80B00B/qpb/media/catalog/product/cache/11/image/439x334/9df78eab33525d08d6e5fb8d27136e95/q/w/qw_neverdonejoggers_p_.png'}}
/>
</View>
Run Code Online (Sandbox Code Playgroud)
对于第一个github URL,它按预期正确呈现img徽标.但是对于第二个Image,它不会渲染源:qw_neverdonejoggers_p_.png
这导致我得出错误的URL的结论,但点击URL正确加载Img:
我试图在这里复制这个问题,https: //rnplay.org/apps/_dQXXw ,但它可以正确渲染这两个图像.
因此,它只能在我的本地计算机上出于某种原因才能呈现第二张图像?
使用:"react":"15.4.1","react-native":"^ 0.39.2",
我正在尝试编写一个Swift应用程序,它从博客中提取RSS源并将其显示在屏幕上.出现错误:App Transport Security已阻止明文HTTP(http://)资源加载,因为它不安全.可以通过应用程序的Info.plist文件配置临时例外.
如何将一个博客的网站Info.plist配置为例外?下拉菜单中没有NSAllowsArbitraryLoads选项.
我刚刚安装了 react-native-image-crop。当我试图在真正的 iPhone 上拍照时,我收到了一个非常奇怪的错误。'App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.'
. 这是因为我使用地铁建设者吗?或者别的什么?
我的信息.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
Run Code Online (Sandbox Code Playgroud) 我试图在设备连接到特定 WiFi 后加载本地网络下的网页。
我收到此错误:
WebPageProxy::didFailProvisionalLoadForFrame:frameID = 3,域= NSURLErrorDomain,代码= -1202
我可以毫无问题地加载我尝试过的任何其他网页。
我可以在 xcode 模拟器中打开 Safari 上的网页,并且可以看到它,但我之前确实看到了“此连接不是私有的”页面,并且必须单击“访问此网站”按钮。不确定这是否是问题所在。
我必须从服务器访问视频,我希望能够实时访问它的帧,以便我可以对它们进行一些图像处理。
我知道如何使用 AVAssetReader 离线完成,但此解决方案不适用于实时处理。
ios ×6
react-native ×3
swift ×3
swift3 ×2
xcode ×2
avfoundation ×1
deep-linking ×1
deeplink ×1
fetch ×1
http ×1
image ×1
info.plist ×1
ios9 ×1
nsurlsession ×1
reactjs ×1
swiftui ×1
uiwebview ×1
video ×1
wkwebview ×1
xcode8 ×1